#include <bits/stdc++.h>
using namespace std;
inline bool check(long long a, long long b) {
  long long p = a / b;
  if (b == a / p) return 1;
  return 0;
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    long long x;
    cin >> x;
    long long bound = x * 4 / 3 + 100;
    long long M = -1, N = -1;
    for (long long n = 1;; n++) {
      if (n * n > bound) break;
      long long p = n * n - x;
      long long tmp = (long long)sqrt(p * 1.0);
      if (tmp * tmp == p && tmp != 0) {
        long long m = n / tmp;
        if (check(n, tmp)) {
          N = n;
          M = m;
          break;
        }
      }
    }
    if (N == -1)
      printf("-1\n");
    else
      cout << N << " " << M << endl;
  }
  return 0;
}
