s = eval(input())

t = "AKIHABARA"

idx = 0

ng = 0

for i in range(len(t)):

    if t[i] == s[idx]:

        idx += 1

    elif t[i] != "A":

        ng = 1

        break

    if idx == len(s):

        if i < len(t) - 2:

            ng = 1



        break



if idx != len(s):

    ng = 1



if ng:

    print("NO")

else:

    print("YES")

t = eval(input())

s = "AKIHABARA"

posA = [0, 4, 6, 8]

ok = 0

pos = [0, 3, 4, 5]

for i in range(2 ** 4):

    tmp = ""

    now = 0

    for j in range(9):

        if j == posA[now]:

            if i >> now & 1:

                tmp = tmp + s[j]

            now += 1

        else:

            tmp = tmp + s[j]



    if t == tmp:

        ok = 1

        break



if ok == 1:

    print("YES")

else:

    print("NO")

s = eval(input())
t = "AKIHABARA"
idx = 0
ng = 0
for i in range(len(t)):
    if t[i] == s[idx]:
        idx += 1
    elif t[i] != "A":
        ng = 1
        break
    if idx == len(s):
        if i < len(t) - 2:
            ng = 1
        break
if idx != len(s):
    ng = 1
if ng:
    print("NO")
else:
    print("YES")

t = eval(input())
s = "AKIHABARA"
posA = [0, 4, 6, 8]
ok = 0
pos = [0, 3, 4, 5]
for i in range(2**4):
    tmp = ""
    now = 0
    for j in range(9):
        if j == posA[now]:
            if i >> now & 1:
                tmp = tmp + s[j]
            now += 1
        else:
            tmp = tmp + s[j]
    if t == tmp:
        ok = 1
        break
if ok == 1:
    print("YES")
else:
    print("NO")

-s = eval(input()) -t = "AKIHABARA" -idx = 0 -ng = 0 -for i in range(len(t)): -    if t[i] == s[idx]: -        idx += 1 -    elif t[i] != "A": -        ng = 1 +t = eval(input()) +s = "AKIHABARA" +posA = [0, 4, 6, 8] +ok = 0 +pos = [0, 3, 4, 5] +for i in range(2**4): +    tmp = "" +    now = 0 +    for j in range(9): +        if j == posA[now]: +            if i >> now & 1: +                tmp = tmp + s[j] +            now += 1 +        else: +            tmp = tmp + s[j] +    if t == tmp: +        ok = 1 -    if idx == len(s): -        if i < len(t) - 2: -            ng = 1 -        break -if idx != len(s): -    ng = 1 -if ng: +if ok == 1: +    print("YES") +else: -else: -    print("YES")