program main
    implicit none
    integer(8)::A(6)=(/1,0,0,1,1,1/),a_count=0,flg=1,cur=1,i
    character(50)::S,T="KIHBR"
    read*,S
    if(len_trim(S)>9)flg=0
    do i=1,len_trim(S)
        if(S(i:i)=="A")then
            a_count=a_count+1
        else if(S(i:i)==T(cur:cur))then
            if(a_count>A(cur))then
                flg=0
                exit
            else
                a_count=0
                cur=cur+1
            end if
        else
            flg=0
            exit
        end if
    end do
    if(flg==1.and.a_count>A(6))flg=0
    if(flg==1.and.cur<6)flg=0
    if(flg==1)print'(A)',"YES"
    if(flg==0)print'(A)',"NO"
end program main