#include <bits/stdc++.h>
using namespace std;
const int MAXN = (int)(2e5) + 2;
const int MOD = (int)(1e9) + 7;
bool first(long long z) {
  return (long long)sqrt(z * 1.0) * (long long)(sqrt(z * 1.0)) == z;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int tt;
  cin >> tt;
  while (tt--) {
    long long x, m;
    cin >> x;
    bool ok = false;
    for (long long n = 1; n <= 50000; n++) {
      long long cur = n * n - x;
      if (cur <= 0) continue;
      if (first(cur)) {
        cur = sqrt(cur);
        m = n / (cur + 1);
        if (!m) m++;
        for (;; m++) {
          if (m > n) break;
          if (n / m == cur) {
            cout << n << " " << m << endl;
            ok = 1;
            break;
          }
        }
        if (ok) break;
      }
    }
    if (!ok) cout << -1 << endl;
  }
  return 0;
}
