S = eval(input())

T = eval(input())

print(("Yes" if S == T[:len(T)-1] else "No"))
S=eval(input())

T=eval(input())

print(("Yes" if S==T[:-1] else "No"))
S = eval(input())
T = eval(input())
print(("Yes" if S == T[: len(T) - 1] else "No"))

S = eval(input())
T = eval(input())
print(("Yes" if S == T[:-1] else "No"))

-print(("Yes" if S == T[: len(T) - 1] else "No")) +print(("Yes" if S == T[:-1] else "No"))