using System;
public class Program
{
public static void Main()
int x, a = 0;
bool ok = true;
for (int i = 1; i <= 10; i++)
x = int.Parse(Console.ReadLine());
if (x < 10000)
while (x != 0)
a = x % 10;
if (a != 9 && a != 2 && a != 6)
ok = false;
x = x / 10;
}
else ok = false;
if (ok == true)
Console.WriteLine("Yes");
else Console.WriteLine("no");