#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, tc;
  cin >> tc;
  while (tc--) {
    long long n, m, t;
    cin >> t;
    if (t == 0) {
      cout << "1 1\n";
      continue;
    }
    n = m = -1;
    for (long long i = 1; i * i <= t; i++) {
      if (t % i == 0 && !((t / i - i) & 1)) {
        int x = (i + t / i) / 2;
        int y = (t / i - i) / 2;
        int a, b;
        if (y == 0) continue;
        a = ceil((double)x / y);
        b = floor((double)x / y);
        if (a && x / a == y) {
          n = x;
          m = a;
        } else if (b && x / b == y) {
          n = x;
          m = b;
          break;
        }
      }
    }
    if (n != -1)
      cout << n << ' ' << m << endl;
    else
      cout << -1 << endl;
  }
  return 0;
}
