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"))