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