#include <bits/stdc++.h>
using namespace std;
const int MAX = 100010;
const int MOD = 1000000007;
const int INF = (int)1e9;
const long long LLINF = 0x3f3f3f3f3f3f3f3f;
const long double EPS = 1e-7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  cin >> t;
  while (t--) {
    long long x;
    cin >> x;
    bool win = false;
    for (long long n = 1; n <= 100000; n++) {
      long long n2 = n * n;
      if (n2 - x <= 0) continue;
      long long m2 = n2 / (n2 - x);
      long long m = sqrt(m2);
      if (m > 0 and n2 - ((n / m) * (n / m)) == x) {
        win = true;
        cout << n << " " << m << '\n';
        break;
      }
    }
    if (!win) cout << -1 << '\n';
  }
  return 0;
}
