# Arup Guha
# 2/27/2026
# Solution to COP 4516 Problem: Push Button Lock

import math

# Returns n choose k.
def c(n,k):
    return math.factorial(n)//math.factorial(k)//math.factorial(n-k)

# Answers for 0 and 1 for recurrence.
dp = [0,1]

# Get the rest.
for i in range(2,12):

    res = 0
    
    # k is size of first set.
    for k in range(1,i+1):

        # Once we choose k items, we can proceed with any of the
        # dp[i-k] ways to do i-k or less items OR put nothing (1)
        res += c(i,k)*(dp[i-k]+1)

    # This is the exact answer for dp with using all the numbers.
    dp.append(res)

# Process cases.
nC = int(input())
for loop in range(1,nC+1):
    n = int(input())
    print(loop,n,dp[n])
