#include<bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
typedef long long ll;
void solve()
{
int n;
cin >> n;
ll t = sqrt(n << 1);
ll u1 = (t - 1) * t + 2 * n;
ll d1 = 2 * t;
t = t + 1;
ll u2 = (t - 1) * t + 2 * n;
ll d2 = 2 * t;
if ((__int128)u1 * d2 > (__int128)u2 * d1) u1 = u2, d1 = d2;
cout << u1 / __gcd(u1, d1) << " " << d / __gcd(u1, d1) << "\n";
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
int T = 1;
cin >> T;
while (T -- ) solve();
return 0;
}