T = int(input())
dp = [(1,0),(0,1),(1,1),(1,2)] + [(0,0) for _ in range(37)] #๋ฌธ์ ์์ N์ 40๊น์ง๋ผ๊ณ ๋์จ๋ค.
for _ in range(T):
N = int(input())
for i in range(4,N+1):
dp[i] = ( dp[i-1][0] + dp[i-2][0] , dp[i-1][1] + dp[i-2][1] )
print(*dp[N])