#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
const int SZ = 1e5 + 1;
const int MX = 2e9;
inline int check(int n, int m) {
  if (m > n || m <= 0) return -1;
  return (n / m) * (n / m);
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  long long v;
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> v;
    int f = 0;
    for (int n = 1; n * n <= MX; n++) {
      int c0 = n * n - v;
      if (c0 <= 0) continue;
      int sq = sqrt(c0);
      int m = n / sq;
      if (check(n, m) == c0) {
        cout << n << ' ' << m << '\n';
        f = 1;
        break;
      }
      if (check(n, m + 1) == c0) {
        cout << n << ' ' << m + 1 << '\n';
        f = 1;
        break;
      }
      if (check(n, m - 1) == c0) {
        cout << n << ' ' << m - 1 << '\n';
        f = 1;
        break;
      }
      if (check(n, m + 2) == c0) {
        cout << n << ' ' << m + 2 << '\n';
        f = 1;
        break;
      }
      if (check(n, m - 2) == c0) {
        cout << n << ' ' << m - 2 << '\n';
        f = 1;
        break;
      }
    }
    if (!f) cout << -1 << '\n';
  }
  return 0;
}
