import std.stdio;
import std.string;
import std.range;
import std.conv;

void main()
{
	auto N = readln.split.to!(char[]), N = N[0], N = N[1];
	if(N[0]==9,N[1==9]){
		writeln("YES");
	}else{
		writeln("NO");
	}
}