#!/usr/bin/env python3
counts = dict()
with open('input.txt', 'rt') as fin:
for line in fin:
for word in line.split():
counts[word] = counts.get(word, 0) + 1
max = 0
max_word = set()
for word, cnt in counts.items():
if cnt > max:
max_word = {word}
max = cnt
if cnt == max:
max_word.add(word)
with open('output.txt', 'wt') as fout:
fout.write(min(max_word))
#!/usr/bin/env python3
def do(n):
tot.add(n)
for i in arr[n-1]:
if i not in tot:
do(i)
tot = set()
arr = []
for i in range(int(input())):
arr.append(list(map(int,input().split())))
do(1)
print(len(tot))
class figura():
def __init__(self, x, y, colour):
self.x = x
self.y = y
self.colour = colour
class pewka(figura):
def __init__(self, x, y, colour):
super().__init__(x, y, colour)
self.type = "pewka"
class ladja(figura):
def __init__(self, x, y, colour):
super().__init__(x, y, colour)
self.type = "ladja"
fig1 = pewka('a', 1, 'red')
fig2 = ladja('a', 1, 'red')
if any_fig.colour = 'red':
...