PokeMon/Ronikita98.07
PokeMon/anna9829
n1line = input()n1inp = input()
2uch = dict()2person = dict()
3colod = dict()3colod = dict()
n4while line != '':n4while inp != '':
5    mas = line.split(' / ')5    mas = inp.split(' / ')
6    if mas[0].isdigit():6    if mas[0].isdigit():
n7        if not(mas[0] in colod):n7        if not (mas[0] in colod):
8            colod[mas[0]] = set()8            colod[mas[0]] = set()
9        colod[mas[0]].add(mas[1])9        colod[mas[0]].add(mas[1])
10    else:10    else:
n11        if not(mas[0] in uch):n11        if not (mas[0] in person):
12            uch[mas[0]] = set()12            person[mas[0]] = set()
13        uch[mas[0]].add(mas[1])13        person[mas[0]].add(mas[1])
14    line = input()14    inp = input()
15 
15res = dict()16res = dict()
n16for i in uch:n17for i in person:
17    res[i] = 018    res[i] = 0
18    a = set()19    a = set()
n19    for j in uch[i]:n20    for j in person[i]:
20        # print(colod[j])
21        a.update(colod[j])21        a.update(colod[j])
22    res[i] = len(a)22    res[i] = len(a)
nn23 
23list_d = list(res.items())24list_d = list(res.items())
24list_d.sort(key=lambda i: (i[1], i[0]))25list_d.sort(key=lambda i: (i[1], i[0]))
25n = 026n = 0
n26# for i in list_d:n
27#               print( i[0], i[1])
28i = 127i = 1
29num = list_d[-1][1]28num = list_d[-1][1]
n30while i <= len(list_d) and (num == (list_d[-i][1]) or (i == 1)):n29while i <= len(list_d) and (num == list_d[-i][1] or i == 1):
31    # print(list_d[-i][0])
32    n += 130    n += 1
33    i += 131    i += 1
nn32 
34num = n33num = n
35i = 034i = 0
t36while (num > 0):t35while num > 0:
37    print(list_d[-n+i][0])36    print(list_d[-n+i][0])
38    i += 137    i += 1
39    num -= 138    num -= 1
4039
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op