#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 1e-6;
const int MAXN = 1e5 + 10;
const int MAXM = 1e6 + 10;
const long long mod = 1e9 + 7;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    long long x;
    scanf("%lld", &x);
    long long n = ceil(sqrt(x));
    bool flag = false;
    while (!flag && n <= 1e5) {
      long long num = n * n - x;
      long long temp = (long long)sqrt(num);
      if (temp != 0 && temp * temp == num) {
        long long m = n / temp;
        if (n / m == temp || n / (m + 1) == temp) {
          printf("%lld %lld\n", n, m);
          flag = true;
        }
      }
      n++;
    }
    if (!flag) puts("-1");
  }
  return 0;
}
