#include <bits/stdc++.h>
using namespace std;
int main() {
  long long T, i, j, x, m, n, a, b, flag, sum1, sum2;
  scanf("%I64d", &T);
  while (T--) {
    flag = 0;
    m = 0;
    n = 0;
    scanf("%I64d", &x);
    for (i = 1; i < sqrt(x); i++) {
      m = 0;
      n = 0;
      if (x % i == 0) {
        a = i;
        b = x / a;
        if ((a + b) % 2 != 0 || (b - a) % 2 != 0) continue;
        n = (a + b) / 2;
        sum2 = (b - a) / 2;
        m = floor(double(n) / double(sum2));
        if (n * n -
                floor(double(n) / double(m)) * floor(double(n) / double(m)) ==
            x)
          printf("%I64d %I64d\n", n, m);
        else
          continue;
        flag = 1;
        break;
      }
    }
    if (x == 0)
      printf("1 1\n");
    else if (flag == 0)
      printf("-1\n");
  }
}
