S=gets.tr("- \n","").chars.sort*'';puts'0011233450240360405131416'.index(S)&&S.size<3?:YES: :NO