/* -*- coding: utf-8 -*- * * 3088.cc: No.3088 XOR = SUM - yukicoder */ #include #include #include using namespace std; /* constant */ /* typedef */ using ll = long long; /* global variables */ /* subroutines */ /* main */ int main() { int tn; scanf("%d", &tn); while (tn--) { ll n; scanf("%lld", &n); if (n == 0) { puts("0 0"); continue; } ll msb = 1; while ((msb << 1) <= n) msb <<= 1; ll x = msb, y = n ^ msb; if (x > 1) { ll x0 = (x >> 1), y0 = x0 - 1; if (logl(x) + logl(y) < logl(x0) + logl(y0)) x = x0, y = y0; } printf("%lld %lld\n", x, y); } return 0; }