#include <bits/stdc++.h>
using namespace std;
int T, x;
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &x);
    if (x == 0) {
      printf("1 1\n");
      continue;
    } else if (x == 1) {
      printf("-1\n");
      continue;
    }
    bool flag = 1;
    for (int i = 1; i * i < x; i++) {
      if (x % i != 0) continue;
      int a = i, b = x / i;
      if ((a + b) % 2 == 1) continue;
      int aa = (a + b) / 2, bb = (b - a) / 2, xx = aa / bb;
      if (bb == aa / xx) {
        printf("%d %d\n", aa, xx);
        flag = 0;
        break;
      }
    }
    if (flag) printf("-1\n");
  }
  return 0;
}
