char s[5];main(){gets(s);scanf("%4s",s);*s=!puts(!s[3]&&*s-s[1]&&s[1]-s[2]?"NO":"YES");}