#codefestivalchinab. [code_festival_china_b]n-th Points
[code_festival_china_b]n-th Points
Problem
Let us define an strict total order relation between distinct points , on a rectangular coordinate plane as following.
- If and then
- If and and then
- If and and then
- If else,
Your task is to answer many queries that asks, "When you sort the set of all the integer lattice in ascending order by the relation defined above, output the -th (-indexed) element."
Input
Input is given in the following format
:
- On the first line, you will be given an integer , the number of queries.
- On the following lines, each line contains the information of each query. The -th line consists of , the number of the -th query.
Output
Output lines, each line containing the answer to each query in the order the queries appear in the input. Make sure to insert a line break at the end of the last line.
Input Example 1
7
1
2
3
4
5
6
1000000000000000000
Output Example 1
0 0
-1 0
0 -1
0 1
1 0
-2 0
263818038 443288743