#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e4 + 9;
int t, x[maxn];
int sq[maxn];
void init() {
  for (int i = 0; i < maxn; i++) {
    sq[i] = i * i;
  }
}
int slove(int v) {
  for (int i = 1; i < maxn; i++) {
    int tmp = sq[i] - v;
    if (tmp <= 0) continue;
    int pos = lower_bound(sq, sq + maxn, tmp) - sq;
    if (tmp != sq[pos]) continue;
    int m = i / pos;
    int flag = 0;
    while (i / m > pos) {
      m++;
      if (m * pos > i) {
        flag = 1;
        break;
      }
    }
    if (flag) continue;
    printf("%d %d\n", i, m);
    return 1;
  }
  puts("-1");
}
int main() {
  scanf("%d", &t);
  init();
  for (int i = 0; i < t; i++) {
    scanf("%d", &x[i]);
    slove(x[i]);
  }
}
