#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int x;
    scanf("%d", &x);
    bool found = 0;
    for (int n = 1; n <= 200000; n++) {
      int lo = 1, hi = n;
      bool done = 0;
      while (lo <= hi) {
        int m = lo + hi >> 1;
        long long val = 1ll * n * n - 1ll * (n / m) * (n / m);
        if (val == x) {
          done = 1;
          printf("%d %d\n", n, m);
          break;
        }
        if (val < x) lo = m + 1;
        if (val > x) hi = m - 1;
      }
      if (done) {
        found = 1;
        break;
      }
    }
    if (!found) puts("-1");
  }
  return 0;
}
