#include <bits/stdc++.h>
using namespace std;
long long f(long long N, long long m) {
  return (long long)floor((double)N / (double)(m));
}
pair<long long, long long> find(long long xi) {
  if (xi == 0) return make_pair(1, 1);
  for (long long i = 1; i <= sqrt(xi); i++) {
    if (xi % i == 0) {
      long long pi = xi / i;
      long long qi = i;
      if ((pi + qi) % 2 != 0) continue;
      long long N = (pi + qi) / 2;
      if (N < 1 || N > 1000000000) continue;
      long long target = (pi - qi) / 2;
      if (f(N, 1) == target) {
        return make_pair(N, 1);
      }
      long long lbnd = 1;
      long long rbnd = 1000000000;
      long long mid = 1;
      while (f(N, rbnd) != target) {
        if (rbnd - lbnd <= 1) break;
        mid = (lbnd + rbnd) / 2;
        if (f(N, mid) <= target) {
          rbnd = mid;
        } else if (f(N, mid) > target) {
          lbnd = mid;
        }
      }
      long long M = mid;
      if (f(N, M) != target) continue;
      if (M < 1 || M > 1000000000) continue;
      return make_pair(N, M);
    }
  }
  return make_pair(-1, -1);
}
int main() {
  int T;
  cin >> T;
  for (int i = 0; i < T; i++) {
    long long xi;
    cin >> xi;
    pair<long long, long long> fd = find(xi);
    if (fd.first == -1) {
      cout << "-1" << '\n';
      continue;
    }
    cout << fd.first << ' ' << fd.second << '\n';
  }
  return 0;
}
