Rotated Necklaces
A candidate necklace matches a sample if it is a cyclic rotation of the sample. Check each candidate independently.
Input
The first line contains n and k (1 ≤ n ≤ 100000, 1 ≤ k ≤ 10). The second line is the sample lowercase string of length n. The next k lines are candidate strings.
Output
For each candidate print YES if it is a cyclic rotation of the sample; otherwise print NO.
Examples
Input #1
5 4
abcde
abcde
bcdea
cbaed
cdeabOutput #1
YES
YES
NO
YESInput #2
1 3
a
a
b
aaOutput #2
YES
NO
NO
Comments