#include <bits/stdc++.h>
using namespace std;
int static_init = []() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout << fixed;
  return 0;
}();
bool run(int x, int& n, int& m) {
  if (x == 0) {
    n = m = 1;
    return true;
  }
  for (n = sqrt(x + 1); (int64_t)3 * n * n <= (int64_t)4 * x; n++) {
    ;
    int q = sqrt(n * n - x);
    if (q > 0 && n * n - q * q == x) {
      m = n / q;
      if (n / m == q) return true;
    }
  }
  return false;
}
int main() {
  int t, x, n, m;
  cin >> t;
  while (t-- > 0) {
    cin >> x;
    if (run(x, n, m)) {
      cout << n << ' ' << m;
    } else {
      cout << "-1";
    }
    cout << '\n';
  }
  return 0;
}
