Humbertov and the Triangular Spiral

Recently the professor Humbertov Moralov was sick, he had a fever and when he went to bed, he began to have a delirious dream. In the dream he draw over and over again a triangular spiral that began in the origin of the cartesian plane (coordinate (0,0)) and the triangular spiral got bigger every time linking integer coordinates in the cartesian plane. For clarity, the triangular spiral is presented below: The dream was so disturbing and it was repeated so many times, that when Moralov woke up, he remembered perfectly the triangular spiral, and for this reason he drew the previous graphic. In the dream Moralov was disturbed and intrigued because he didn’t know if all the integer coordi- nates could be reached at some point in the triangular spiral and, if that was the case, he also didn’t know what would be the coordinate in the cartesian plane of the n-th point that is reached when draw- ing the triangular spiral. The first doubt was immediately resolved when the professor did the graphic ... all the points (integer coordinates) of the cartesian plane are eventually reached by the triangular spirals! Now the professor Moralov needs your help to indicate the coordinate in the cartesian plane of the n-th point that is reached when drawing the triangular spiral. Input Input begins with an integer t (1 ≤ t ≤ 5∗105), the number of test cases, followed by t lines, each line contains an integer n (1 ≤ n ≤ 1012). Output For each test case, you should print a single line containing two integers, separated by a space, denoting the coordinates x and y in the Cartesian coordinate system of point n in the triangular spiral. Sample Input 15 1 2 3 4 5 6 7

2/2 8 9 10 11 12 13 14 15 Sample Output 00 -1 0 01 10 2 -1 1 -1 0 -1 -1 -1 -2 -1 -3 -1 -2 0 -1 1 02 11 20