s = eval(input())

a = s.count("A")

b = s.count("B")

if a == 3 or b == 3:

  print('No')

else:

  print('Yes')
s=eval(input())

if s=='AAA' or s=='BBB':

  print('No')

else:

  print('Yes')
s = eval(input())
a = s.count("A")
b = s.count("B")
if a == 3 or b == 3:
    print("No")
else:
    print("Yes")

s = eval(input())
if s == "AAA" or s == "BBB":
    print("No")
else:
    print("Yes")

-a = s.count("A") -b = s.count("B") -if a == 3 or b == 3: +if s == "AAA" or s == "BBB":