#include <bits/stdc++.h>
using namespace std;
int get(int n, int m) {
  int nn = n * n;
  int r = n / m;
  return nn - r * r;
}
int breach(int l, int r, int n, int x) {
  if (l > r) return -1;
  int mid = (l + r) / 2;
  int num = get(n, mid);
  if (num == x)
    return mid;
  else if (num < x)
    return breach(mid + 1, r, n, x);
  else
    return breach(l, mid - 1, n, x);
}
int main() {
  int t, x, m;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &x);
    bool flag = false;
    for (int i = 1; i <= 40000; i++) {
      int r = i * i;
      if (r > x) {
        m = breach(1, i, i, x);
        if (m != -1) {
          printf("%d %d\n", i, m);
          flag = true;
          break;
        }
      }
    }
    if (!flag) printf("-1\n");
  }
  return 0;
}
