while 1:a,_,b,_,c,_,d=map(ord,input());print("YNeos"[18!=abs(a-c)+(b-d)**4::2])