#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int N = 100005;
vector<int> adj[N];
void solve() {
  int x;
  cin >> x;
  for (int n = 1; n <= int(1e5); ++n) {
    int y = sqrt(1ll * n * n - x + .0);
    if (y == 0) continue;
    int m = n / y;
    if (m == 0) continue;
    if (1ll * n * n - 1ll * (n / m) * (n / m) == x) {
      cout << n << " " << m << endl;
      return;
    }
  }
  cout << "-1\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
