#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long i, j, k, n, m, ans = 0, sum = 0, a[100005] = {0}, mn = 2e9, mx = 0,
                           x, y, z, zero;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x;
    int flag = 0;
    m = -1;
    k = sqrt(x);
    if (k * k != x) {
      k = k + 1;
    }
    for (j = k; j * j <= 1e10; j++) {
      zero = j * j - x;
      y = sqrt(zero);
      if (y * y == zero && y != 0) {
        ans = j;
        m = j / y;
        long long a = j / m;
        a = a * a;
        if (a == zero) {
          flag = 1;
          break;
        }
      }
    }
    if (flag == 0) {
      cout << -1 << endl;
    } else {
      cout << ans << " " << m << endl;
    }
  }
  return 0;
}
