#include <bits/stdc++.h>
using namespace std;
vector<int> sq;
inline int isSqr(int x) {
  auto it = lower_bound(sq.begin(), sq.end(), x);
  if (*it == x) return (it - sq.begin());
  return -1;
}
int myCeil(int a, int b) {
  int ret = a / b;
  if (b * ret < a) ++ret;
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long lim = 2 * 1000000000 + 1;
  for (long long i = 0; i * i <= lim; ++i) sq.push_back(i * i);
  int t;
  cin >> t;
  while (t--) {
    int x;
    cin >> x;
    if (x == 0) {
      cout << "1 1\n";
      continue;
    }
    int n, m;
    bool found = false;
    int pos = (upper_bound(sq.begin(), sq.end(), x) - sq.begin());
    for (int i = pos; i < (int)sq.size(); ++i) {
      int n2 = sq[i];
      int zeros = n2 - x;
      if (zeros > x) break;
      int root = isSqr(zeros);
      if (root > -1) {
        int st = myCeil(i + 1, root + 1);
        int en = (i + 1) / root;
        if (root * en == i + 1) --en;
        if (st <= en) {
          m = st;
          n = i;
          found = true;
          break;
        }
      }
    }
    if (found)
      cout << n << " " << m << "\n";
    else
      cout << "-1\n";
  }
  return 0;
}
