PokeMon/anna9829
PokeMon/Ronikita98.07
n1inp = input()n1line = input()
2person = dict()2uch = dict()
3colod = dict()3colod = dict()
n4while inp != '':n4while line != '':
5    mas = inp.split(' / ')5    mas = line.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 person):n11        if not(mas[0] in uch):
12            person[mas[0]] = set()12            uch[mas[0]] = set()
13        person[mas[0]].add(mas[1])13        uch[mas[0]].add(mas[1])
14    inp = input()14    line = input()
15 
16res = dict()15res = dict()
n17for i in person:n16for i in uch:
18    res[i] = 017    res[i] = 0
19    a = set()18    a = set()
n20    for j in person[i]:n19    for j in uch[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)
n23 n
24list_d = list(res.items())23list_d = list(res.items())
25list_d.sort(key=lambda i: (i[1], i[0]))24list_d.sort(key=lambda i: (i[1], i[0]))
26n = 025n = 0
nn26# for i in list_d:
27#               print( i[0], i[1])
27i = 128i = 1
28num = list_d[-1][1]29num = list_d[-1][1]
n29while i <= len(list_d) and (num == list_d[-i][1] or i == 1):n30while i <= len(list_d) and (num == (list_d[-i][1]) or (i == 1)):
31    # print(list_d[-i][0])
30    n += 132    n += 1
31    i += 133    i += 1
n32 n
33num = n34num = n
34i = 035i = 0
t35while num > 0:t36while (num > 0):
36    print(list_d[-n+i][0])37    print(list_d[-n+i][0])
37    i += 138    i += 1
38    num -= 139    num -= 1
3940
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op