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