'''****** Задание ******** *Властелин Чисел: Братство общей цифры. ''' elves = int(input()) dwarfs = int(input()) humans = int(input()) if elves // 10 == dwarfs // 10 == humans // 10: print(elves // 10) elif elves % 10 == dwarfs % 10 == humans % 10: print(elves % 10) else: print('NO')