#include #include using namespace std; using ll = long long; using cint = boost::multiprecision::cpp_int; #define rep(i, n) for (int i = 0; i < (int)(n); i++) void solve() { ll n; cin >> n; if (n == 0) { cout << "0 0\n"; return; } cint x = 0, y = 0, mx = -1; rep(i, 100) { cint nowx = 1ll << i, nowy = min(n - nowx, nowx - 1); if (n < nowx) break; cint now = nowx * nowy; if (mx < now) { mx = now, x = nowx, y = nowy; } } cout << x << ' ' << y << '\n'; } int main() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); int T = 1; cin >> T; for (int t = 0; t < T; t++) { solve(); } return 0; }