#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long x, i;
    cin >> x;
    bool flag = false;
    if (x == 0) {
      cout << "1 1" << endl;
      continue;
    }
    for (i = 1; i * i < x; i++) {
      if (x % i) continue;
      if ((i + (x / i)) % 2) continue;
      long long n1 = (i + (x / i)) / 2, n2 = ((x / i) - i) / 2;
      long long n3 = n1 / n2;
      if (n1 * n1 - (n1 / n3) * (n1 / n3) == x) {
        cout << n1 << " " << n3 << endl;
        break;
      }
    }
    if (i * i >= x) cout << "-1" << endl;
  }
}
