#include #include #include #include #include using namespace std; using namespace atcoder; using ll = long long; using mint = modint998244353; using vi = vector; using vvi = vector; using vvvi = vector; using vll = vector; using vvll = vector; using vvvll = vector; using vmi = vector; using vvmi = vector; using vvvmi = vector; #define all(a) (a).begin(), (a).end() #define rep2(i, m, n) for (int i = (m); i < (n); ++i) #define rep(i, n) rep2(i, 0, n) #define drep2(i, m, n) for (int i = (m)-1; i >= (n); --i) #define drep(i, n) drep2(i, n, 0) int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int t; cin >> t; while(t--){ ll n; cin >> n; bitset<64> bs(n); if(n <= 2){ cout << (n+1)/2 << " 0" << endl; continue; } if(n <= 3){ cout << (n+1)/2 << " 1" << endl; continue; } bitset<64> x, y; int b; drep(i, 64){ if(bs[i]){ b = i; break; } } if(bs[b-1] || bs[b-2]){ x.set(b); drep(j, b)y[j] = bs[j]; }else{ x.set(b-1); drep(j, b-1)y[j] = 1; } cout << x.to_ullong() << " " << y.to_ullong() << endl; } return 0; }