s=eval(input());print(('YNeos'[any(s.count(t)!=2for t in s)::2]))
print(('YNeos'[len(set(eval(input())))!=2::2]))
s = eval(input())
print(("YNeos"[any(s.count(t) != 2 for t in s) :: 2]))

print(("YNeos"[len(set(eval(input()))) != 2 :: 2]))

-s = eval(input()) -print(("YNeos"[any(s.count(t) != 2 for t in s) :: 2])) +print(("YNeos"[len(set(eval(input()))) != 2 :: 2]))