Skip to main content
LIVE CONTEST: Round #7 · Begin Marathon is live now! …
Problems
#854

~/algor $ cat problems/TKfAsjZvzMH6

A staircase of cubes

Easy 1000 ms 64 MB 31%
Share

A staircase is built from cubes: the first step has cube, the second , the third and so on; every step must be complete. What is the largest number of steps that can be built, and how many cubes are left over? This question is asked times, each time for its own .

n = 8 cubes: three steps of 1, 2 and 3 cubes and 2 cubes left over

Input

The first line contains a positive integer . Each of the next lines contains one positive integer .

Output

lines, each with two integers: the number of steps and the number of cubes left over.

Note


Examples

Input #1
3
8
1
6
Output #1
3 2
1 0
3 0
Input #2
2
2
1000000000000000000
Output #2
1 1
1414213561 1234742859

Sign in to submit a solution

Signing up is free and takes a minute.