A=map(int,input().split('.')) B=map(int,input().split('.')) for x,y in zip(A,B): # print(x,y) if xy: print('YES') break else:print('NO')