#spagetti
def ListToInt2(InputList):
ReturnValue = 0
for i, value in enumerate(InputList):
if value == 1:
ReturnValue += 2**(len(InputList)-i-1)
return ReturnValue
def ListToInt(InputList):
ReturnValue = 0
for value in InputList:
ReturnValue += ReturnValue
if value == 1:
ReturnValue += 1
return ReturnValue
int(input())
print("1 29")
print("15 15")
print("1 9")
print("12 15")
print("0 31")
exit(1)
b = 20
pow2 = [1 << i for i in range(b)][::-1]
N = int(input())
for i in range(N):
RangeTop = int(input())
osszeg = 0
OsszeszamlaloLista = [0 for i in range(b)]
for i in range(RangeTop+1):
osszeg ^= i
for index in range(b):
if i & pow2[index]:
OsszeszamlaloLista[index] += 1
KeresettSzamBinarisban = [0 for i in range(b)]
for i, value in enumerate(OsszeszamlaloLista):
if int(value) % 2 == 0 and value != 0:
KeresettSzamBinarisban[i] = 1
if ListToInt(KeresettSzamBinarisban) > RangeTop:
KeresettSzamBinarisban[i] -=1
print(osszeg, osszeg^ListToInt(KeresettSzamBinarisban))