#include <stdio.h>

int main() {
    int t;
    scanf("%d", &t);
    while (t--) {
        unsigned long long n;
        scanf("%llu", &n);
        int cnt = __builtin_popcountll(n);  // 二进制中1的个数
        unsigned long long min_idx = (cnt == 0) ? 0 : ((1ULL << cnt) - 1);
        printf("%d %llu\n", cnt, min_idx);
    }
    return 0;
}