#include <bits/stdc++.h>
using namespace std;
long long x, t, n, m;
int main() {
  cin >> t;
  while (t--) {
    bool flag = false;
    cin >> x;
    if (x == 0)
      cout << 1 << " " << 1 << endl;
    else if (x == 1)
      cout << -1 << endl;
    else {
      for (long long i = 1; i * i <= x; i++) {
        if ((x % i == 0) && ((i & 1) == ((x / i) & 1))) {
          n = (i + x / i) / 2;
          long long temp = n - i;
          if (temp == 0) continue;
          m = n / temp;
          if (n >= m && temp == (n / m)) {
            cout << n << " " << m << endl;
            flag = 1;
            break;
          }
        }
      }
      if (!flag) cout << -1 << endl;
    }
  }
  return 0;
}
