#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;
}