b_major, b_minor, b_build = map(int, input().split('.')) t_major, t_minor, t_build = map(int, input().split('.')) if b_major > t_major: print('YES') elif b_major == t_major and b_minor > t_minor: print('YES') elif b_major == t_major and b_minor == t_minor and b_build > t_build: print('YES') elif b_major == t_major and b_minor == t_minor and b_build == t_build: print('YES') else: print('NO')