#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const long long inf = 0x3f3f3f3f3f3f3f3f;
const int maxn = 100005;
int x, t, n, m;
int main() {
  cin >> t;
  while (t--) {
    bool fg = false;
    cin >> x;
    if (x == 0)
      cout << "1 1\n";
    else if (x == 1)
      cout << "-1\n";
    else {
      for (int i = 1; i * i <= x; i++) {
        if ((x % i == 0) && ((i & 1) == ((x / i) & 1))) {
          n = (i + x / i) / 2;
          int tmp = n - i;
          if (tmp == 0) {
            continue;
          }
          m = n / tmp;
          if (n >= m && tmp == (n / m)) {
            cout << n << ' ' << m << endl;
            fg = 1;
            break;
          }
        }
      }
      if (!fg) cout << "-1\n";
    }
  }
}
