#include<bits/stdc++.h>
#define endl "\n"
#define ll long long
using namespace std;
constexpr ll N = 1e6 + 7, mod = 1000000007, inf = 0x3f3f3f3f3f3f3f3f;

void solve(int tc) {
    ll x;
    cin >> x;
    ll a = 0 , b = 0;
    ll f = 1;
    for (int i = 62 ; i  ; i --) {
        if (x >> i &1) {
            if (f ) {
                b |= (1ll << i);
                f--;
            }else {
                a |= (1ll<< i);
            }
        }
    }
  cout << a << ' ' << b<<endl;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r",stdin);
    freopen("output.txt", "w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int TC = 1; cin>>TC;
    for (int i = 1; i <= TC; i++) {
        solve(i);
    }
}
