#include <bits/stdc++.h>
using namespace std;
void doit(long long x) {
  long long temp, i, n;
  for (i = 1; i < 100000; i++) {
    temp = i * i - x;
    if (temp <= 0)
      continue;
    else {
      n = ceil(sqrt(temp));
      if (n * n == temp) {
        long long c1 = i / n, c2 = i / (n + 1);
        if (c1 > c2) {
          cout << i << " " << i / n << endl;
          return;
        }
      }
    }
  }
  cout << "-1\n";
}
int main() {
  long long i, t, n, m, x;
  cin >> t;
  while (t--) {
    cin >> x;
    if (!x)
      cout << "1 1" << endl;
    else if (x == 1)
      cout << -1 << endl;
    else
      doit(x);
  }
  return 0;
}
