s=eval(input())

t=eval(input())

if s+t[-1]==t:

    print('Yes')

else:

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

t=eval(input())

if s==t[:-1]:

    print('Yes')

else:

    print('No')
s = eval(input())
t = eval(input())
if s + t[-1] == t:
    print("Yes")
else:
    print("No")

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

-if s + t[-1] == t: +if s == t[:-1]: