#include <bits/stdc++.h>
using namespace std;
bool iss(int v) {
  int x = sqrt(v);
  return x * x == v;
}
map<int, pair<int, int> > ans;
int main() {
  for (int i = 1; i <= 1000; i++) {
    for (int j = 1; j <= i; j++) {
      int v = i * i -
              ((i + 2 * j - 2) / (2 * j - 1)) * ((i + 2 * j - 2) / (2 * j - 1));
      ans[v] = make_pair(i, j);
    }
  }
  int t;
  cin >> t;
  while (t--) {
    int x;
    cin >> x;
    bool tt = false;
    if (x == 0) {
      cout << 1 << ' ' << 1 << endl;
      continue;
    }
    if (x == 1) {
      cout << -1 << endl;
      continue;
    }
    bool ff = false;
    for (int n = 1; n <= 44444; n++) {
      int d = n * n;
      if (d > x && iss(d - x)) {
        int l = sqrt(d - x);
        int mm = (n) / l;
        for (int i = 0; i < 5; i++) {
          if ((n) / mm == l) {
            cout << n << ' ' << (mm) << endl;
            ff = true;
            break;
          }
          mm++;
        }
        if (ff) break;
      }
    }
    if (!ff) {
      cout << -1 << endl;
    }
  }
  return 0;
}
