#include <bits/stdc++.h>
using namespace std;
const long long N = 100005;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  vector<long long> sq;
  for (long long i = 1; i * i <= 1e10; i++) {
    sq.push_back(i * i);
  }
  long long t;
  cin >> t;
  while (t--) {
    long long i, j, k, n = -1, m = -1, ans = 0, cnt = 0, sum = 0;
    long long x;
    cin >> x;
    for (auto ele : sq) {
      long long ind = lower_bound(sq.begin(), sq.end(), ele - x) - sq.begin();
      if (sq[ind] == ele - x) {
        long long nn = sqrt(ele);
        long long mm = nn / sqrt(ele - x);
        if ((nn / mm) * (nn / mm) == ele - x) {
          n = sqrt(ele);
          m = n / sqrt(ele - x);
          break;
        }
      }
    }
    if (n == -1 or m == -1) {
      cout << -1 << "\n";
      continue;
    }
    cout << n << " " << m << "\n";
  }
  return 0;
}
