#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
using namespace std;
/**
* @author johnsondu
* @time 2015-8-19 16:37
* @type Binary Index tree
* @key try to understand how to retrieve
* the last bit of a number which is 1.
* @url http://poj.org/problem?id=2309
*/
int main()
{
int tcase;
int q;
scanf("%d", &tcase);
while(tcase --) {
scanf("%d", &q);
int lowbit = q & (-q);
printf("%d %d\n", q-lowbit+1, q+lowbit-1);
}
return 0;
}