#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")
using namespace std;
const int MaxN = 5e5 + 17;
const int INF = 1e9 + 17;
const int MOD = 1e9 + 7;
const double eps = 1e-9;
const double pi = 3.14159265359;
long long check2(long long n, long long m) {
  long long l = 1, r = n;
  while (l <= r) {
    long long mm = (l + r) >> 1;
    long long x = n / mm;
    if (n * n - x * x == m) return mm;
    if (n * n - x * x > m) {
      r = mm - 1;
    } else
      l = mm + 1;
  }
  return 0;
}
void solve(long long x) {
  if (x == 1) {
    printf("-1\n");
    return;
  }
  if (x == 0) {
    printf("1 1\n");
    return;
  }
  long long l = 1, r = 1e9, ans = 0;
  while (l <= r) {
    long long m = (l + r) >> 1;
    if (x > m * m) {
      ans = m;
      l = m + 1;
    } else
      r = m - 1;
  }
  long long w = 1e9;
  for (long long i = 0; i <= 50000; ++i) {
    long long x2 = check2(ans + i, x);
    if (x2 && x2 <= w && ans + i <= w) {
      printf("%lld %lld\n", ans + i, x2);
      return;
    }
  }
  printf("-1\n");
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    long long x;
    scanf("%lld", &x);
    solve(x);
  }
  return 0;
}
