#include <bits/stdc++.h>
using namespace std;
void solve();
signed main() {
  srand(time(0));
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.precision(10);
  solve();
}
const long long INF = 1e18, MAXN = 2e5 + 10, MOD = 1e9 + 7;
void query() {
  long long first;
  cin >> first;
  if (first == 0) {
    cout << 1 << " " << 1 << '\n';
    return;
  }
  long long d = 1;
  while (d * d <= first) {
    if (first % d == 0) {
      long long d1 = d, d2 = first / d;
      if (d2 < d1) swap(d1, d2);
      if ((d2 - d1) % 2 == 0) {
        long long k = (d2 - d1) / 2;
        long long n = k + d1;
        long long l = 1, r = n + 1;
        while (r - l > 1) {
          long long mid = (r + l) / 2;
          if (n / mid >= k) {
            l = mid;
          } else {
            r = mid;
          }
        }
        if (n / l == k) {
          cout << n << " " << l << '\n';
          return;
        }
      }
    }
    d++;
  }
  cout << -1 << '\n';
}
void solve() {
  long long t;
  cin >> t;
  for (long long i = 0; i < t; ++i) {
    query();
  }
}
