a=list(map(int,input().split()));t=list(map(len,input().split('-')));print(['No','Yes'][a==t])
print(['No','Yes'][list(map(int,input().split()))==list(map(len,input().split('-')))])
a = list(map(int, input().split()))
t = list(map(len, input().split("-")))
print(["No", "Yes"][a == t])

print(
    ["No", "Yes"][list(map(int, input().split())) == list(map(len, input().split("-")))]
)

-a = list(map(int, input().split())) -t = list(map(len, input().split("-"))) -print(["No", "Yes"][a == t]) +print( +    ["No", "Yes"][list(map(int, input().split())) == list(map(len, input().split("-")))] +)