#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 7;
const long long maxd = 1e5;
const int mod = 1e9 + 7;
const int INF = 0x7f7f7f7f;
int n;
long long x;
int main() {
  cin >> n;
  while (n--) {
    cin >> x;
    if (x == 0) {
      cout << 1 << " " << 1 << endl;
      continue;
    }
    long long i;
    for (i = 2; i < maxd; ++i) {
      if (i * i > x) {
        long long t = i * i - x;
        if ((long long)sqrt(t * 1.0) * (long long)sqrt(t * 1.0) == t) {
          long long tt = (i / (long long)sqrt(t * 1.0));
          if (i >= tt && i * i - (i / tt) * (i / tt) == x) {
            cout << i << " " << tt << endl;
            break;
          }
        }
      }
    }
    if (i == maxd) cout << -1 << endl;
  }
  return 0;
}
