def recursive(depth, idx) :
#탈출 조건
if depth == 6:
print(*answer)
return
#dfs 로직
for i in range(idx, k):
answer.append(s[i])
recursive(depth+1, i+1)
answer.pop()
while True:
inputs = list(map(int, input().split()))
answer = []
k = inputs[0]
s = inputs[1:]
if k == 0 :
exit()
recursive(0, 0)
print()
# 1 2 3 4 5 6 7 8 9 10 11 12 13
참고 :