#include <iostream>
using namespace std;
long long fx(long long x)
{
if(x==0) return 0;
if(x==1) return 1;
return fx(x/2)+fx(x%2);
}
int main() {
int t;
cin>>t;
while(t--)
{
long long x;
cin>>x;
long long c=fx(x);
cout<<c<<" "<<(1LL<<c)-1<<endl;;
}
return 0;
}
// 64 位输出请用 printf("%lld")



京公网安备 11010502036488号