z=max, while 1:z+=raw_input(),;print`map(*z)`[2::5]