#include <bits/stdc++.h>
using namespace std;
const int N = 200200;
const int mod = 1e9 + 7;
inline void solve() {
  int x, ff = -1, ss;
  cin >> x;
  long long st = sqrt(x + 0.5);
  st = max(st, 1ll);
  for (long long n = st; n <= st + 50000; ++n) {
    long long cnt = n * n;
    long long l = 1, r = n + 1;
    while (l + 1 < r) {
      long long m = (l + r) >> 1;
      if (cnt - (n / m) * (n / m) > x)
        r = m;
      else
        l = m;
    }
    if (cnt - (n / l) * (n / l) == x) {
      ff = n, ss = l;
    }
  }
  if (ff == -1)
    cout << "-1\n";
  else
    cout << ff << " " << ss << endl;
}
int main() {
  int t;
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> t;
  for (int i = 1; i <= t; ++i) solve();
  return 0;
}
