## Algorithm

C. Infinity Table
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Polycarp has found a table having an infinite number of rows and columns. The rows are numbered from 1">11, starting from the topmost one. The columns are numbered from 1">11, starting from the leftmost one.

Initially, the table hasn't been filled and Polycarp wants to fix it. He writes integers from 1">11 and so on to the table as follows.

The figure shows the placement of the numbers from 1">11 to 10">1010. The following actions are denoted by the arrows.

The leftmost topmost cell of the table is filled with the number 1">11. Then he writes in the table all positive integers beginning from 2">22 sequentially using the following algorithm.

First, Polycarp selects the leftmost non-filled cell in the first row and fills it. Then, while the left neighbor of the last filled cell is filled, he goes down and fills the next cell. So he goes down until the last filled cell has a non-filled neighbor to the left (look at the vertical arrow going down in the figure above).

After that, he fills the cells from the right to the left until he stops at the first column (look at the horizontal row in the figure above). Then Polycarp selects the leftmost non-filled cell in the first row, goes down, and so on.

A friend of Polycarp has a favorite number k">k. He wants to know which cell will contain the number. Help him to find the indices of the row and the column, such that the intersection of the row and the column is the cell containing the number k">k.

Input

The first line contains one integer t">t (1≤t≤100">1t1001≤�≤100) — the number of test cases. Then t">t test cases follow.

Each test case consists of one line containing one integer k">k (1≤k≤109">1k1091≤�≤109) which location must be found.

Output

For each test case, output in a separate line two integers r">r and c">c (r,c≥1">r,c1�,�≥1) separated by spaces — the indices of the row and the column containing the cell filled by the number k">k, respectively.

Example
input
Copy
7
11
14
5
4
1
2
1000000000

output
Copy
2 4
4 3
1 3
2 1
1 1
1 2
31623 14130


## Code Examples

### #1 Code Example with C++ Programming

Code - C++ Programming

#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define endl '\n'
#define debug(n) cout<<(n)<<endl;
const ll INF = 2e18 + 99;

int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);

int t;
cin>>t;
int n;
while(t--){
cin>>n;
int i = 0;
int dif;
while(true){
i++;
dif = n - (i * (i-1) + 1) ;
dif *= dif > 0 ? 1 : -1;
if(dif < i){
break;
}
}
dif = n - (i * (i-1) + 1) ;
if(dif > 0){
cout<<i<<" "<<(i - dif)<<endl;
continue;
}
cout<<(i+dif)<<" "<<i<<endl;

}
}
Copy The Code &

Input

cmd
7
11
14
5
4
1
2
1000000000

Output

cmd
2 4
4 3
1 3
2 1
1 1
1 2
31623 14130