name_first, age_first = input().split()
name_second, age_second = input().split()
print(f'{name_first if int(age_first) < int(age_second) else name_second} старше на {abs(int(age_first) - int(age_second))} год(а)')
name_first, age_first = input().split()
name_second, age_second = input().split()
print(f'{name_first if int(age_first) < int(age_second) else name_second} старше на {abs(int(age_first) - int(age_second))} год(а)')