https://www.acmicpc.net/problem/9095
import sys
t = int(sys.stdin.readline())
for _ in range(t):
n = int(sys.stdin.readline())
dp = [0]*(n+1)
dp[0] = 1 # 0의 값 1로 설정해준다
for i in range(1, n+1):
answer = 0
for j in range(1, 3+1):
if i - j >= 0:
answer += dp[i-j]
dp[i] = answer
print(dp[n])