#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    long long x;
    cin >> x;
    long long nlow = sqrt(x) + 1;
    long long nup = sqrt(4 * x / 3) + 1;
    long long ln = std::min(nlow, nup);
    long long un = std::max(nlow, nup);
    bool found = false;
    for (long long n = max(ln, (long long)1); n <= un; n++) {
      long n2 = n * n;
      if (n2 - x == 0) continue;
      long long lowm = sqrt((n2 - x + 1) / n2);
      long long upm = sqrt(n2 / (n2 - x)) + 1;
      for (int m = lowm; m <= upm; m++) {
        if (m == 0) continue;
        if ((n2 - (n / m) * (n / m)) == x) {
          cout << n << " " << m << endl;
          found = true;
          break;
        }
      }
      if (found) break;
    }
    if (!found) cout << -1 << endl;
  }
}
