using System;
public class Program
{
public static void Main()
int n1=int.Parse(Console.ReadLine());
int n2=int.Parse(Console.ReadLine());
if(check(n1,n2))
Console.WriteLine("yes");
else
Console.WriteLine("no");
}
public static bool check(int n1,int n2)
bool ok=true;
int c=0,d=0;
while(n1!=0)
c++;
n1/=10;
while(n2!=0)
d++;
n2/=10;
if(!(c%2==0&&d%2==0))
ok=false;
if(!(n1%100+1==n2%100))
n1/=100;
n2/=100;
if(ok)
return true;
return false;