#include <bits/stdc++.h>
using namespace std;
long long int t;
long long int x;
int32_t main() {
  cin >> t;
  while (t--) {
    cin >> x;
    if (x == 0) {
      cout << "1 1\n";
      continue;
    }
    bool is = 0;
    for (long long int i = 1; i <= (sqrt(x) + 2); i++) {
      if (x % i != 0) continue;
      long long int one = i;
      long long int two = x / i;
      if (one >= two || ((one + two) % 2 != 0)) continue;
      long long int ek = (one + two) / 2;
      long long int doo = (two - one) / 2;
      doo = ek / doo;
      if ((ek * ek - (ek / doo) * (ek / doo)) == x) {
        is = 1;
        cout << ek << " " << doo << "\n";
        break;
      }
    }
    if (!is) {
      cout << "-1\n";
    }
  }
}
