# https://open.kattis.com/problems/icpcawards

n = int(input())
unis = set()
count = 0

for _ in range(n):
    uni, team = input().split()
    if count == 12 or uni in unis:
        continue

    print('%s %s' % (uni, team))
    unis.add(uni)
    count += 1

8c240137dd0daa04e7a3b3dc79f91ad47e630c7d
<mask token>

<mask token>
for _ in range(n):
    uni, team = input().split()
    if count == 12 or uni in unis:
        continue
    print('%s %s' % (uni, team))
    unis.add(uni)
    count += 1

n = int(input())
unis = set()
count = 0
for _ in range(n):
    uni, team = input().split()
    if count == 12 or uni in unis:
        continue
    print('%s %s' % (uni, team))
    unis.add(uni)
    count += 1

# https://open.kattis.com/problems/icpcawards

n = int(input())
unis = set()
count = 0

for _ in range(n):
    uni, team = input().split()
    if count == 12 or uni in unis:
        continue

    print('%s %s' % (uni, team))
    unis.add(uni)
    count += 1
