#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int x;
    scanf("%d", &x);
    bool ok = false;
    int ans1, ans2;
    for (int i = 1; (long long)i * i < 2e9; i++) {
      int tmp = i * i - x;
      if (tmp <= 0) continue;
      int u = int(sqrt(tmp) + 0.5);
      if (u * u != tmp) continue;
      if (i / (i / u) == u) {
        ans1 = i;
        ans2 = i / u;
        ok = true;
        break;
      }
    }
    if (!ok)
      puts("-1");
    else
      printf("%d %d\n", ans1, ans2);
  }
  return 0;
}
