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