#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int x;
    cin >> x;
    if (x == 0) {
      cout << "1 1\n";
      continue;
    }
    bool ok = false;
    int an, am;
    for (int i = 1; i * i < x; i++) {
      if (x % i == 0) {
        int y = x / i;
        if ((i + y) % 2 != 0) continue;
        int p = (i + y) / 2;
        int k = (y - i) / 2;
        int n = p;
        int m = n / k;
        if (m == 0) continue;
        if (n / m == k) {
          ok = true;
          an = n;
          am = m;
        }
      }
    }
    if (ok)
      cout << an << " " << am << "\n";
    else
      cout << "-1\n";
  }
}
