#include <bits/stdc++.h>
using ll = long long;
ll sq(ll a) {
  ll left = 0, right = 1e5;
  while (right - left > 1) {
    ll mid = (left + right) / 2;
    if (mid * mid <= a) {
      left = mid;
    } else {
      right = mid;
    }
  }
  if (left * left == a) {
    return left;
  } else {
    return -1;
  }
}
int main() {
  int t = 0;
  std::cin >> t;
  while (t--) {
    ll x, left = 0, right = 0, up = 0, down = 0;
    std::cin >> x;
    if (x == 0) {
      std::cout << "1 1\n";
      continue;
    }
    left = 1;
    right = 1e5;
    while (right - left > 1) {
      ll mid = (left + right) / 2;
      if (mid * mid - (mid / 2) * (mid / 2) <= x) {
        left = mid;
      } else {
        right = mid;
      }
    }
    up = left + 1;
    left = 0;
    right = 1e5;
    while (right - left > 1) {
      ll mid = (left + right) / 2;
      if (mid * mid > x) {
        right = mid;
      } else {
        left = mid;
      }
    }
    down = right;
    bool print = 0;
    for (ll i = down; i <= up; ++i) {
      ll tmp = sq(i * i - x);
      if (tmp != -1 && tmp == (i / (i / tmp))) {
        std::cout << i << ' ' << i / tmp << '\n';
        print = 1;
        break;
      }
    }
    if (!print) {
      std::cout << "-1\n";
    }
  }
}
