#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
inline long long toll(string s) {
  long long v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    long long Z;
    cin >> Z;
    if (Z == 0) {
      cout << 1 << " " << 1 << endl;
      continue;
    }
    long long ansA = -1, ansB = -1;
    for (long long i = 1; i * i <= Z; i++) {
      if (Z % i == 0) {
        long long x = Z / i;
        long long y = i;
        if (y < x) swap(x, y);
        if ((x + y) & 1LL) continue;
        long long a = (x + y) / 2LL;
        long long b = y - a;
        if (a <= 0 || b <= 0) continue;
        long long maxi = max(a, b);
        long long mini = min(a, b);
        long long wind = maxi / mini;
        long long numWind = maxi / wind;
        if (maxi * maxi - numWind * numWind != Z) continue;
        ansA = maxi;
        ansB = wind;
      }
    }
    if (ansA == -1)
      cout << -1 << endl;
    else
      cout << max(ansA, ansB) << " " << min(ansA, ansB) << endl;
  }
  return 0;
}
