a = input().split(".") b = input().split(".") if a[0] == a[0]: print('YES') else: print('NO')