y, m, d = gets.split.map(&:to_i) if (y >= 1989 && m >= 1 && d >= 8) && (y <= 2019 && m >= 4 && d >= 30) puts "YES" else puts "No" end