PokeMon/abrivan
PokeMon/Stephan
n1igrok = dict()n
2kart = dict()1x = dict()
2y = dict()
3spis = input()3z = input()
4while spis:4while z:
5    spis = spis.split('/')5    z = z.split('/')
6    if spis[0][0:-1].isdigit():6    if z[0][0:-1].isdigit():
7        if spis[0][0:-1] in kart:7        if z[0][0:-1] in y:
8            kart[spis[0][0:-1]] += [spis[1][1:]]8            y[z[0][0:-1]] += [z[1][1:]]
9        else:9        else:
n10            kart[spis[0][0:-1]] = [spis[1][1:]]n10            y[z[0][0:-1]] = [z[1][1:]]
11    else:11    else:
n12        if spis[0][0:-1] in igrok:n12        if z[0][0:-1] in x:
13            igrok[spis[0][0:-1]] += [spis[1][1:]]13            x[z[0][0:-1]] += [z[1][1:]]
14        else:14        else:
t15            igrok[spis[0][0:-1]] = [spis[1][1:]]t15            x[z[0][0:-1]] = [z[1][1:]]
16    spis = input()16    z = input()
17kart_igrok = dict()17y_x = dict()
18for i in igrok:18for i in x:
19    kart_ig = set()19    y_ig = set()
20    for j in igrok[i]:20    for j in x[i]:
21        kart_ig |= set(kart[j])21        y_ig |= set(y[j])
22    kart_igrok[i] = len(kart_ig)22    y_x[i] = len(y_ig)
23maxi = max([kart_igrok[i] for i in kart_igrok])23maxi = max([y_x[i] for i in y_x])
24print(*sorted([i for i in kart_igrok if kart_igrok[i] == maxi]), sep='\n')24print(*sorted([i for i in y_x if y_x[i] == maxi]), sep='\n')
2525
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op