import sys
import copy
input = sys.stdin.readline
while True:
num = list(map(int, input().split(" ")))
n = num[0]
num = num[1:]
if n == 0:
break
visited = [0 for _ in range(n+1)]
arr = [0 for _ in range(6)]
answer = []
def func(num, dep, pre):
if dep == 6:
temp = copy.deepcopy(arr)
answer.append(temp)
return
for i in range(pre, len(num)):
if visited[i] == 0:
arr[dep] = num[i]
visited[i] = 1
func(num, dep + 1, i)
visited[i] = 0
func(num, 0, 0)
for a in answer:
a = [str(i) for i in a]
print(' '.join(a))
print()
728x90
반응형
'🔻PS > Baekjoon' 카테고리의 다른 글
[Baekjoon] 백준 1941 소문난 칠공주 Python (0) | 2024.07.29 |
---|---|
[Baekjoon] 백준 15724 주지수 (0) | 2024.07.16 |
[Baekjoon] 백준 2644 촌수계산 Python (0) | 2024.05.19 |
[Baekjoon] 백준 10026 적록색약 Python (0) | 2024.05.17 |
[Baekjoon] 백준 2935 소음 Python (0) | 2024.05.12 |