N = int(input()) p = list(map(int, input().split())) q = [] count = len(p) // 2 for _ in range(count): min_p = min(p[:-1]) index = p.index(min_p) q.append(p.pop(index)) q.append(p.pop(index)) ans = ' '.join([str(v) for v in q]) print(ans)