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