#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e6 + 100;
const long long INF = 9 * (long long)(1e18);
const long double PI = 3.14159265358979323846;
long long int modexp(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  if (y == 0)
    return 1;
  else if (x == 0)
    return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res % p;
}
vector<long long int> fact(N + 1, 1);
void factmod(long long int n, long long int k) {
  for (long long int i = 2; i <= n; i++) fact[i] = (i * fact[i - 1]) % k;
}
vector<long long int> invfact(N + 1, 1);
void factinvmod(long long int n, long long int k) {
  for (long long int i = 2; i <= n; i++) {
    invfact[i] = modexp(fact[i], k - 2, k);
  }
}
long long int ncrmod(long long int n, long long int r, long long int k) {
  return (((fact[n] * invfact[n - r]) % k) * invfact[r]) % k;
}
vector<long long int> is_prime(N + 1, 1);
void sieve(long long int n) {
  for (long long int i = 1; i <= n; i++) is_prime[i] = i;
  for (long long int i = 2; i * i <= n; i++) {
    if (is_prime[i] == i) {
      for (long long int j = i * i; j <= n; j += i) {
        is_prime[j] = min(i, is_prime[j]);
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int testc;
  cin >> testc;
  while (testc--) {
    long long int x;
    cin >> x;
    int flag = 0;
    long long int a, b;
    for (long long int i = 1; i <= sqrt(x); i++) {
      if (x % i == 0) {
        int c = i, d = x / i;
        if (c % 2 == d % 2) {
          a = (c + d) / 2;
          b = (d - c) / 2;
          if (b != 0) {
            int temp = a / b;
            temp = a / temp;
            if (b == temp) {
              b = a / b;
              flag = 1;
              break;
            }
          }
        }
      }
    }
    if (x == 0) {
      a = 1;
      b = 1;
      flag = 1;
    }
    if (flag)
      cout << a << " " << b << "\n";
    else
      cout << -1 << "\n";
  }
}
