#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    long long x;
    scanf("%lld", &x);
    if (x == 0)
      printf("1 1\n");
    else if (x == 1)
      printf("-1\n");
    else {
      int flag = 0;
      for (long long n = 1; n < 1e5 + 10; n++) {
        if (n * n <= x) continue;
        long long k = sqrt(n * n - x);
        long long m = n / k;
        if (k > 0 && n * n - (n / m) * (n / m) == x) {
          flag = 1;
          printf("%lld %lld\n", n, m);
          break;
        }
      }
      if (!flag) printf("-1\n");
    }
  }
  return 0;
}
