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