#include using namespace std; using ll = long long; void solve() { ll n; cin >> n; if (n == 0) { cout << "0 0\n"; return; } ll x = (1ll << (63 - __builtin_clzll(n))); if (n == x) { cout << x << ' ' << n - x << '\n'; return; } ll y = (1ll << (63 - __builtin_clzll(n ^ x))); if ((y << 2) >= x) cout << x << ' ' << n - x << '\n'; else { y = x >> 1; cout << y << ' ' << y - 1 << '\n'; } } int main() { cin.tie(nullptr)->sync_with_stdio(false); int q; cin >> q; while (q--) { solve(); } return 0; }