x=[]

y=[]

for _ in [0]*3:

  a = sorted([input().split()[::-1] for _ in [0]*8])

  x += a[0:2]

  y += a[2:4]

x += sorted(y)[0:2]



for e in x:

  print(" ".join(e[::-1]))
x=[]

for e in [[input() for _ in [0]*8] for _ in [0]*3]+[x]:

  b = sorted(e, key = lambda x: x.split()[1])

  x += b[2:4]

  print('\n'.join(b[:2]))
x = []
y = []
for _ in [0] * 3:
    a = sorted([input().split()[::-1] for _ in [0] * 8])
    x += a[0:2]
    y += a[2:4]
x += sorted(y)[0:2]
for e in x:
    print(" ".join(e[::-1]))

x = []
for e in [[input() for _ in [0] * 8] for _ in [0] * 3] + [x]:
    b = sorted(e, key=lambda x: x.split()[1])
    x += b[2:4]
    print("\n".join(b[:2]))

-y = [] -for _ in [0] * 3: -    a = sorted([input().split()[::-1] for _ in [0] * 8]) -    x += a[0:2] -    y += a[2:4] -x += sorted(y)[0:2] -for e in x: -    print(" ".join(e[::-1])) +for e in [[input() for _ in [0] * 8] for _ in [0] * 3] + [x]: +    b = sorted(e, key=lambda x: x.split()[1]) +    x += b[2:4] +    print("\n".join(b[:2]))