while 1:a,b,c=raw_input().split();print'NYOE\rS'[a in b in c::2]