#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long x;
    cin >> x;
    if (x == 0) {
      cout << 1 << " " << 1 << endl;
      continue;
    }
    long long n;
    bool can = false;
    for (n = 1; n < 1e5; n++) {
      if (n * n <= x) continue;
      long long k = n * n - x;
      if ((long long)sqrt(k) * (long long)sqrt(k) != k) continue;
      long long m = n / (long long)sqrt(k);
      if (n / m == (long long)sqrt(k)) {
        can = true;
        cout << n << " " << m << endl;
        break;
      }
    }
    if (!can) {
      cout << "-1\n";
    }
  }
}
