import std.stdio, std.conv, std.string, std.bigint;
import std.math, std.random, std.datetime;
import std.array, std.range, std.algorithm, std.container, std.format;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

void main(){
	int y = read.to!int;
	int m = read.to!int;
	int d = read.to!int;
	
	auto ans = "No";
	int x = y * 10000 + m * 100 + d;
	if(x >= 19890108 && x <= 20190430) ans = "Yes";
	
	ans.writeln;
}