from itertools import combinations
N,A,B,C=map(int,input().split())
l = []
for i in range(N):
    l.append(int(input()))
input_l = list(map(list,combinations(l,3)))
except_l = [l[:] for _ in range(len(input_l))]
for i in range(len(input_l)):
    except_l[i].remove(input_l[i][0])
    except_l[i].remove(input_l[i][1])
    except_l[i].remove(input_l[i][2])
print(input_l)
print(except_l)