Олимпиадный тренинг

Задача 42269. space roadmap


Задача

Темы: Множества
Deniska wants to go on a space journey on ships with warp engines. To do this, he bought a space roadmap. There are N stations on the first open intergalactic warp line operated by the ITC (Interstellar Transportation Company). The ith station (1<=i<=N) from the start station is called Si.
Regular spaceships stop at all stations, while warp ships (spaceships with warp drives) only stop at M (M <= N) stations, and jth station (1 <= j <= M) is the station named Tj.
Here it is guaranteed that T1 = S1 and T= SN , i.e. warp ships stop both at the starting and end stations.
Deniska wants to ride the warpship. For each of the N stations, determine if Deniska can get to that station in the warpship.

Input
The program receives three lines as input. The first line contains two integers N and M (2 <= M <= N <=105). The second line contains N different words Si (1 <= i <= N, ) separated by a space - the title stations where conventional spacecraft stop. The third line contains M various words Tj (1 <= j <= M, ) separated by a space - the name of the stations where warp ships stop. All words in the third line (T1,...,TM) is obtained by removing zero or more lines from (S1,... ,SN) and line up the remaining words without changing the order. 

Imprint
Output N lines. The i-th line (1<= i <=N) should contain Yes if Deniska gets to the i-th station from the starting station by warp ship, otherwise - No< /code>.
 
 
Examples
# Input Output
1
5 3
andoria kanda badjor betazed ueno
andoria badjor ueno
Yes
no
Yes
no
Yes
2
7 7
a b c d e f g
a b c d e f g
Yes
Yes
Yes
Yes
Yes
Yes
Yes