10
71
8497
6364
6530
9199
5754
1508
9388
6992
4494
72
8512
8192
8192
9216
8192
2048
9472
8192
4608

import sys
read = sys.stdin.readlines()
read = map(int, read)
num = read[0]
def check(n):
	if '11' in bin(n)[2:]:
		return True
	return False
for i in read[1:]:
	while True:
		if not check(i):
			print i
			break
		i+=1