#include <bits/stdc++.h>
using namespace std;
inline int scn() {
  int hg;
  cin >> hg;
  return hg;
};
const int MOD = 1000 * 1000 * 1000 + 7;
const int N = 200006;
const long long INF = 1000000000000000007;
void solve() {
  long long x;
  cin >> x;
  if (x == 0) {
    cout << 1 << " " << 1 << endl;
    return;
  }
  for (long long i = 1; i <= sqrt(x); i++) {
    if (x % i == 0 && (x / i + i) % 2 == 0) {
      long long n = (x / i + i) / 2;
      if (n * n <= x) continue;
      long long m = n / sqrtl(n * n - x);
      if (n * n - (n / m) * (n / m) == x) {
        cout << n << " " << m << endl;
        return;
      }
    }
  }
  cout << -1 << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
