ucnum = int(input())
ans = list()
for i in range(ucnum):
    n = int(input())
    if n <= 3:
        ans.append(1)
        continue
    p1 = 1
    p2 = 1
    p3 = 1
    n -= 3
    while n > 0:
        temp = p2 + p3
        p2 = p1
        p3 = p2
        p1 = temp
        n -= 1
    ans.append(p1)
for i in ans:
    print(i)

7fbe9403396020aa8d9c3417607841e5ae994695
<mask token>

<mask token>
for i in range(ucnum):
    n = int(input())
    if n <= 3:
        ans.append(1)
        continue
    p1 = 1
    p2 = 1
    p3 = 1
    n -= 3
    while n > 0:
        temp = p2 + p3
        p2 = p1
        p3 = p2
        p1 = temp
        n -= 1
    ans.append(p1)
for i in ans:
    print(i)

ucnum = int(input())
ans = list()
for i in range(ucnum):
    n = int(input())
    if n <= 3:
        ans.append(1)
        continue
    p1 = 1
    p2 = 1
    p3 = 1
    n -= 3
    while n > 0:
        temp = p2 + p3
        p2 = p1
        p3 = p2
        p1 = temp
        n -= 1
    ans.append(p1)
for i in ans:
    print(i)
