#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
const long long mod = 1e9 + 7;
const double eps = 1e-7;
long long x;
long long n, mm, m;
long long cal(long long n, long long m) { return n / m + !(n % m == 0); }
int check(long long a, long long b) {
  if (a < b) swap(a, b);
  n = (a + b) / 2;
  mm = (a - b) / 2;
  if (mm == 0) return 0;
  long long res = n / mm;
  long long temp = res;
  while (n / res != mm && res <= temp + 10) res++;
  if (res == temp + 11) return 0;
  m = res;
  return 1;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    cin >> x;
    long long temp = x;
    int flag = 0;
    if (x == 0) {
      printf("1 1\n");
      continue;
    }
    for (int i = 1; i * i <= x; i++) {
      if (x % i == 0) {
        if ((i + x / i) % 2 == 0) {
          if (check(i, x / i)) {
            flag = 1;
            printf("%lld %lld\n", n, m);
            break;
          }
        }
      }
    }
    if (!flag) cout << -1 << endl;
  }
  return 0;
}
