#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << setprecision(32);
  int t;
  cin >> t;
  while (t--) {
    long long x;
    cin >> x;
    if (x == 0) {
      cout << 1 << " " << 1 << '\n';
      continue;
    }
    bool flg = false;
    for (int d = 1; d * d < x; d++) {
      if (x % d) continue;
      long long npk = x / d;
      long long nnk = d;
      if ((npk ^ nnk) & 1) continue;
      long long n = (npk + nnk) / 2;
      long long k = (npk - nnk) / 2;
      long long m = n / k;
      if (n / m == k) {
        cout << n << " " << m << '\n';
        flg = true;
        break;
      }
    }
    if (!flg) cout << -1 << '\n';
  }
  return 0;
}
