#include using namespace std; using i64 = long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); auto solve = [&]() { int n; cin >> n; if (n == 0) { cout << 0 << ' ' << 0 << '\n'; return; } int x = 1 << __lg(n); i64 res1 = 1LL * x * (n - x); i64 res2 = 1LL * x / 2 * (x / 2 - 1); if (res1 > res2) { cout << x << ' ' << n - x << '\n'; } else { cout << x / 2 << ' ' << x / 2 - 1 << '\n'; } }; int t; cin >> t; while (t--) { solve(); } return 0; }