//#pragma GCC target("avx2") //#pragma GCC optimize("O3") //#pragma GCC optimize("unroll-loops") #include using namespace std; using ll = __int128_t; using pii = pair; using pll = pair; using pli = pair; #define TEST cerr << "TEST" << endl #define AMARI 998244353 //#define AMARI 1000000007 #define el '\n' #define El '\n' #define YESNO(x) ((x) ? "Yes" : "No") #define YES YESNO(true) #define NO YESNO(false) #define REV_PRIORITY_QUEUE(tp) priority_queue,greater> #define NO_ANS(x) {cout << (x) << '\n'; return;} template void inline VEC_UNIQ(vector &v){ sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end()); return; } ll func(ll n,ll &x,ll &y){ //cerr << (long long)n << el; vector digit; for(int i = 0; i < 62; i++){ if((1LL << i) & n)digit.push_back(i); } sort(digit.rbegin(),digit.rend()); x = 0LL; y = 0LL; x += (1LL << digit[0]); for(int i = 1; i < (int)digit.size(); i++){ y += (1LL << digit[i]); } return (x * y); } #define MULTI_TEST_CASE true void solve(void){ //問題を見たらまず「この問題設定から言えること」をいっぱい言う //一個回答に繋がりそうな解法が見えても、実装や細かい詰めに時間がかかりそうなら別の方針を考えてみる //ある程度考察しても全然取っ掛かりが見えないときは実験をしてみる //よりシンプルな問題に言い換えられたら、言い換えた先の問題を自然言語ではっきりと書く //複数の解法のアイデアを思いついた時は全部メモしておく //g++ -D_GLIBCXX_DEBUG -Wall -Wextra -O2 f.cpp -o o long long n; cin >> n; if(n <= 2){ cout << 0 << ' ' << n << el; return; } //a + b <= n ll val1,x1,y1; ll val2,x2,y2; val1 = func(n,x1,y1); ll nc = n; for(int i = 61; i >= 0; i--){ if(n & (1LL << i)){ n &= (1LL << i); n--; break; } } val2 = func(n,x2,y2); if(val1 > val2){ cout << (long long)x1 << ' ' << (long long)y1 << el; return; } cout << (long long)x2 << ' ' << (long long)y2 << el; return; } void calc(void){ return; } signed main(void){ cin.tie(nullptr); ios::sync_with_stdio(false); calc(); int t = 1; if(MULTI_TEST_CASE)cin >> t; while(t--){ solve(); } return 0; }