m: int = None
values = list(map(int,input().split()))
for value in values:
if (m is None or value < m) and value > 0: m = value
print(m)
m: int = None
values = list(map(int,input().split()))
for value in values:
if (m is None or value < m) and value > 0: m = value
print(m)