#include <bits/stdc++.h>
using namespace std;
long long int find_m(long long int l, long long int r, long long int x) {
  long long int n = r;
  while (l < r) {
    long long int mid = (l + r) / 2ll;
    if (n * n - (n / mid) * (n / mid) == x) {
      return mid;
    } else if (n * n - (n / mid) * (n / mid) > x) {
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  if (n * n - (n / l) * (n / l) == x)
    return l;
  else
    return -1;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    long long int x;
    cin >> x;
    bool found = false;
    for (long long int cur_n = 1; cur_n <= 1e5; cur_n++) {
      int cur_m = find_m(1, cur_n, x);
      if (cur_m == -1)
        continue;
      else {
        found = true;
        cout << cur_n << " " << cur_m << "\n";
        break;
      }
    }
    if (!found) cout << -1 << "\n";
  }
  return 0;
}
