#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  long long x, n, m;
  while (t--) {
    cin >> x;
    bool print = false;
    for (n = sqrt(x); n * n <= 2 * x + 1; n++) {
      m = n / sqrt(n * n - x);
      if (n > 0 && m > 0 && n * n - (n / m) * (n / m) == x) {
        cout << n << " " << m << '\n';
        print = true;
        break;
      }
    }
    if (!print) cout << "-1\n";
  }
}
