#pragma GCC optimize("O3,unroll-loops")
#include<bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define all(x) x.begin(), x.end()
using namespace std;
const int maxn = 1e7 + 1;
const int N = 5e4 + 1;
bool checkPrime(ll n)
{
if (n == 2 || n == 3) return true;
if (n < 2 || n % 2 == 0 || n % 3 == 0) return false;
for (int i = 5; 1ll * i * i <= n; i += 6) {
if (n % i == 0 || n % (i + 2) == 0) return false;
}
return true;
}
vector<int> Prime;
void GenPrime() {
Prime.push_back(2);
int n = sqrt(2e9);
for (int i = 3; i <= n; i += 2) {
if (checkPrime(i)) Prime.push_back(i);
}
}
bool hoanvi[20];
ll A[N];
void Solve(ll n, ll x) {
ll maxn = pow(2, n) - 1;
bool check = false;
for (int i = 1; i <= maxn; ++i) {
for (int it = 1; it <= 19; ++it) hoanvi[i] = false;
int tmp = i, j = 0;
while (tmp != 0) {
++j;
hoanvi[j] = (tmp % 2 == 0 ? false : true);
tmp /= 2;
}
ll C1 = 1, C2 = 1;
for (int k = 1; k <= n; ++k) {
if (hoanvi[k]) {
C1 *= A[k];
}
else {
C2 *= A[k];
}
}
if (C2 < C1) swap(C1, C2);
if ((C1 - 1 + C2) % 2 == 0) {
ll R = (C1 - 1 + C2) / 2;
ll L = C2 - R;
if (R < x) {
cout << L << " " << R;
check = true;
break;
}
}
}
if (!check) {
cout << -1;
}
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
GenPrime();
int t;
cin >> t;
ll x, n = Prime.size();
int i = 0, j = 0;
while (t--) {
for (int it = 1; it <= i; ++it) {
A[it] = 0;
}
i = 0; j = 0;
cin >> x;
ll motcaigiday = x;
x *= 2;
while (x != 1 && j < n) {
if (x % Prime[j] == 0) {
++i;
ll value = 1;
while (x % Prime[j] == 0) {
x /= Prime[j];
value *= Prime[j];
}
A[i] = value;
}
++j;
}
if (x != 1) {
++i;
A[i] = x;
}
sort(A + 1, A + i + 1);
Solve(i, motcaigiday);
cout << "\n";
}
}
I3ByYWd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