#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
lol:
  while (t--) {
    long long int v, i;
    cin >> v;
    for (i = 1; i <= 1e5; ++i)
      if (i * i > v) {
        long long int val = (long long int)(i / (sqrt(i * i - v)));
        if (i * i == v + (i / val) * (i / val)) {
          cout << i << " " << val << "\n";
          goto lol;
        }
      }
    cout << "-1\n";
  }
  return 0;
}
