| f | from collections import defaultdict | f | from collections import defaultdict | 
            | n | deck_cards = defaultdict(set) | n | slcard = defaultdict(set) | 
            |  | player_decks = defaultdict(set) |  | slchel = defaultdict(set) | 
            |  | while (line := input()): |  | while (strk := input()): | 
            |  | l1, l2 = line.split(' / ') |  | i, j = strk.split(' / ') | 
            |  | if l1.isdigit(): |  | if i.isdigit(): | 
            |  | deck_cards[l1].add(l2) |  | slcard[i].add(j) | 
            |  | else: |  | else: | 
            | t | player_decks[l1].add(l2) | t | slchel[i].add(j) | 
            |  | for p, cs in player_decks.items(): |  | for chel, card in slchel.items(): | 
            |  | player_decks[p] = len(set((card_name for c in cs for card_name in de |  | slchel[chel] = len(set((card for ch in card for card in slcard[ch])) | 
            |  | ck_cards[c]))) |  | ) | 
            |  | maxvalue = max(player_decks.values()) |  | Maxi = max(slchel.values()) | 
            |  | print(*sorted([x for x in player_decks if player_decks[x] == maxvalue]), |  | print(*sorted([card for card in slchel if slchel[card] == Maxi]), sep='\ | 
            |  | sep='\n') |  | n') |