atcoder#ABC236C. [ABC236C] Route Map

[ABC236C] Route Map

Score : 300300 points

Problem Statement

There are NN stations on a certain line operated by AtCoder Railway. The ii-th station (1iN)(1 \leq i \leq N) from the starting station is named SiS_i.

Local trains stop at all stations, while express trains may not. Specifically, express trains stop at only M(MN)M \, (M \leq N) stations, and the jj-th stop (1jM)(1 \leq j \leq M) is the station named TjT_j. Here, it is guaranteed that T1=S1T_1 = S_1 and TM=SNT_M = S_N, that is, express trains stop at both starting and terminal stations.

For each of the NN stations, determine whether express trains stop at that station.

Constrains

  • 2MN1052 \leq M \leq N \leq 10^5
  • NN and MM are integers.
  • SiS_i (1iN)(1 \leq i \leq N) is a string of length between 11 and 1010 (inclusive) consisting of lowercase English letters.
  • SiSj(ij)S_i \neq S_j \, (i \neq j)
  • T1=S1T_1 = S_1 and TM=SNT_M = S_N.
  • (T1,,TM)(T_1, \dots, T_M) is obtained by removing zero or more strings from (S1,,SN)(S_1, \dots, S_N) and lining up the remaining strings without changing the order.

Input

Input is given from Standard Input in the following format:

NN MM

S1S_1 \ldots SNS_N

T1T_1 \ldots TMT_M

Output

Print NN lines. The ii-th line (1iN)(1 \leq i \leq N) should contain Yes if express trains stop at the ii-th station from the starting station, and No otherwise.

5 3
tokyo kanda akiba okachi ueno
tokyo akiba ueno
Yes
No
Yes
No
Yes
7 7
a t c o d e r
a t c o d e r
Yes
Yes
Yes
Yes
Yes
Yes
Yes

Express trains may stop at all stations.