#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long t, n, x = -1, y = -1;
  cin >> t;
  while (t--) {
    bool flag = 0;
    cin >> n;
    if (n == 0) {
      cout << 1 << ' ' << 1 << endl;
    } else if (n == 1)
      cout << -1 << endl;
    else {
      for (long long i = 1; i * i < n; i++) {
        if (n % i == 0) {
          long long j = n / i;
          if ((i + j) % 2 == 0) {
            x = (i + j) / 2;
            long long temp = x - i;
            if (temp == 0) continue;
            y = x / temp;
            if (x >= y && temp == x / y) {
              cout << x << ' ' << y << endl;
              flag = 1;
              break;
            }
          }
        }
        if (flag) break;
      }
      if (!flag) cout << -1 << endl;
    }
  }
  return 0;
}
