#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    if (n == 0) {
      cout << "1 1\n";
      continue;
    }
    int flag = 0;
    if (sqrt(n) == ceil(sqrt(n))) flag = 1;
    for (int i = 1; i <= sqrt(n); i++) {
      if (n % i == 0) {
        int a = -1;
        if ((i + (n / i)) % 2 == 0) {
          a = (i + (n / i)) / 2;
          int ab = a - i;
          if (a - i <= 0) continue;
          int b = a / ab;
          if (a * a - (a / b) * (a / b) == n) {
            cout << a << " " << b << "\n";
            goto en;
          }
        }
      }
    }
    cout << "-1\n";
  en:;
  }
}
