#include <bits/stdc++.h>
using namespace std;
int Sqrt(int x) {
  int r = sqrt(x);
  for (int i = -1; i < 1; ++i) {
    if (r + i > 0 && (r + i) * (r + i) == x) return r + i;
  }
  return -1;
}
int main() {
  int t;
  scanf("%d", &t);
  for (int i = 0; i < t; ++i) {
    int x;
    scanf("%d", &x);
    if (x == 0)
      printf("1 1\n");
    else if (x == 1 || x == 4 || x % 4 == 2)
      printf("-1\n");
    else {
      bool flag = true;
      for (int n = sqrt((double)x); n * n - (n / 2) * (n / 2) <= x; ++n) {
        int root = Sqrt(n * n - x);
        if (root < 0) continue;
        int m = n / root;
        if (n * n - (n / m) * (n / m) == x) {
          printf("%d %d\n", n, m);
          flag = false;
          break;
        }
      }
      if (flag) printf("-1\n");
    }
  }
  return 0;
}
