#PUTESHESTVIJE

def path_finder(prodavnice: dict)->list:
    pass

diksnari = {1 : [2,3,4], 2 : [1,3,4], 3 : [1,2,4], 4 : [1,2,3]}

N = int(input())
for i in range(N-4):
    komsije = list(map(int, input().split()))
    diksnari[i+5] = komsije
    for j in range(3):
        diksnari[komsije[j]].append(i+5)

print(diksnari)
"""
class Graph:
    def __init__(self, N):
        self.N = N
        self.adj_list = {i: [] for i in range(1, N + 1)}


    def add_edge(self, u, v):
        if v not in self.adj_list[u]:
            self.adj_list[u].append(v)
        if u not in self.adj_list[v]:
            self.adj_list[v].append(u)

    def add_neighbors(self, node, neighbors):
        for neighbor in neighbors:
            self.add_edge(node, neighbor)

    def __repr__(self):
        return str(self.adj_list)


N = int(input())
graph = Graph(N)

graph.add_neighbors(1, [2, 3, 4])
graph.add_neighbors(2, [1, 3, 4])
graph.add_neighbors(3, [1, 2, 4])
graph.add_neighbors(4, [1, 2, 3])

for i in range(N - 4):
    komsije = list(map(int, input().split()))
    graph.add_neighbors(i + 5, komsije)

print(graph)
G = graph
"""
def hamilton(graph, start_v):
  size = len(graph)
  to_visit = [None, start_v]
  path = []
  while(to_visit):
    v = to_visit.pop()
    if v :
      path.append(v)
      if len(path) == size:
        break
      for x in set(graph[v])-set(path):
        to_visit.append(None) 
        to_visit.append(x) 
    else:
      path.pop()
  return path + [1]

print(hamilton(diksnari,1))