#include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve()
{
int n, row = 1;
cin >> n;
while (n > 0){
if (n > row)
n -= row;
else break;
row++;
}
cout << row <<" "<< n << endl;
}
int main()
{
int t;
cin >> t;
while (t--)
solve();
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgbGwgbG9uZyBsb25nCnZvaWQgc29sdmUoKQp7CglpbnQgbiwgcm93ID0gMTsKCWNpbiA+PiBuOwoJd2hpbGUgKG4gPiAwKXsKCQlpZiAobiA+IHJvdykKCQkJbiAtPSByb3c7CgkJZWxzZSBicmVhazsKCQlyb3crKzsKCX0KCWNvdXQgPDwgcm93IDw8IiAiPDwgbiA8PCBlbmRsOyAKfQppbnQgbWFpbigpCnsKCWludCB0OwoJY2luID4+IHQ7Cgl3aGlsZSAodC0tKQoJCXNvbHZlKCk7CglyZXR1cm4gMDsKfQ==