#include <bits/stdc++.h>
using namespace std;
long long x, t, n, m;
int main() {
  scanf("%I64d", &t);
  for (int o = 1; o <= t; o++) {
    int flag = 0;
    scanf("%I64d", &x);
    if (x == 0)
      printf("1 1\n");
    else if (x == 1)
      printf("-1\n");
    else {
      for (long long i = 1; i * i <= x; i++) {
        if ((x % i == 0) && ((i & 1) == ((x / i) & 1))) {
          n = (i + x / i) / 2;
          long long tp = n - i;
          if (tp == 0) continue;
          m = n / tp;
          if (n >= tp && tp == (n / m)) {
            printf("%I64d %I64d\n", n, m);
            flag = 1;
            break;
          }
        }
      }
      if (!flag) printf("-1\n");
    }
  }
  return 0;
}
