program h1B
    implicit none
    integer(8)::i,N,a_seq,cursor
    integer(8)::flg=0
    character(50)::S
    character(5)::mask="KIHBR"
    read(5,*)S
    N=len_trim(S)
    a_seq=0
    cursor=1

    do i=1,N
        if(S(i:i)/="A")then
            a_seq=0
            if(cursor==6)then
                flg=1
                exit
            end if

            if(S(i:i)==mask(cursor:cursor))then
                cursor=cursor+1
            else
                flg=1
                exit
            end if
        else
            a_seq=a_seq+1
            if(a_seq==2)then
                flg=1
                exit
            end if
        end if
    end do

    if(cursor/=6)flg=1

    if(flg==1)then
        print'(A)',"NO"
    else
        print'(A)',"YES"
    end if
end program h1B