#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t, x, val, n, m;
  cin >> t;
  while (t--) {
    cin >> x;
    bool flag = true;
    for (int i = 0; i <= 100000 && flag; i++) {
      val = x + i * i;
      n = sqrt(val);
      if (n * n == val) {
        for (int j = 1; j <= n && flag; j++) {
          if (n / j == i) {
            m = j;
            flag = false;
          }
        }
      }
    }
    if (flag)
      cout << "-1\n";
    else
      cout << n << " " << m << "\n";
  }
  return 0;
}
