#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, ok, st, dr, mid, T, X, SN, SM, N, M;
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &X);
    ok = 0;
    for (N = 1; N <= 200000; ++N) {
      for (st = 1, dr = N; st <= dr;) {
        M = (st + dr) / 2;
        long long Y = 1LL * N * N - 1LL * (N / M) * (N / M);
        if (Y > X)
          dr = M - 1;
        else if (Y < X)
          st = M + 1;
        else {
          ok = 1;
          st = dr + 1;
          SN = N;
          SM = M;
          N = 200000 + 2;
        }
      }
    }
    if (ok)
      printf("%d %d\n", SN, SM);
    else
      printf("-1\n");
  }
  return 0;
}
