#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
const int oo = 1e9;
const int mod = 1e5;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    long long x;
    scanf("%lld", &x);
    if (x == 0) {
      printf("1 1\n");
      continue;
    }
    bool f = 0;
    for (long long i = 1; i <= 50000; i++) {
      long long p = i * i;
      if (x > p) continue;
      long long md, lo = 1, hi = i;
      while (lo <= hi) {
        md = (lo + hi) / 2;
        long long tm = p - (i / md) * (i / md);
        if (tm == x) {
          f = 1;
          printf("%lld %lld\n", i, md);
          break;
        }
        if (tm < x) {
          lo = md + 1;
        } else {
          hi = md - 1;
        }
      }
      if (f) break;
    }
    if (!f) {
      printf("-1\n");
    }
  }
}
