#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast,no-stack-protector")
using namespace std;
function<void(void)> ____ = []() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
};
template <typename T>
vector<T> &operator<<(vector<T> &__container, T x) {
  __container.push_back(x);
  return __container;
}
template <typename T>
ostream &operator<<(ostream &out, vector<T> &__container) {
  for (T _ : __container) out << _ << ' ';
  return out;
}
const int MAXN = 2e5 + 7;
void solve() {
  int n;
  scanf("%d", &n);
  if (n == 0) {
    cout << 1 << ' ' << 1 << "\n";
    return;
  }
  for (int i = 1; i * i <= n; i++) {
    if (n % i != 0) continue;
    if (i == n / i) continue;
    int x = n / i, y = i;
    if ((x + y) & 1) continue;
    int a = (x + y) >> 1;
    int b = (x - y) >> 1;
    for (int l = 1, r; l <= a; l = r + 1) {
      r = a / (a / l);
      if (a / l == b) {
        cout << a << ' ' << l << "\n";
        return;
      }
    }
  }
  cout << -1 << "\n";
  return;
}
int main() {
  int tt;
  for (scanf("%d", &tt); tt--; solve())
    ;
  return 0;
}
