Walf's clothes have possible colors, labelled from to . His top clothing rack has hats, the -th hat having a color of . His bottom clothing rack has shirts, the -th shirt having a color of . No two hats have the same color and no two shirts have the same color.
The colors of hats on the rack are given by and color of his shirts are given by . These values are fixed and regardless of what Walf wears, his racks will reset to this state at the end of the day.
Each morning, Walf picks a hat and a shirt to wear (for obvious reasons, he only wears blue jeans). To help him decide, his friend Fax restricts his hat choices to and his shirt choices to . The values of , , , and change from day to day.
There are days in total. For each day, output if it's possible that Walf wears the same color hat and shirt. More formally, output if there's some and such that .
Constraints
- The values of are all unique
- The values of are all unique
Input Specification
The first line of input will contain two numbers, and .
The second line of input will contain numbers, the th number is .
The third line of input will contain numbers, the th number is .
The next lines will contain 4 numbers each, each line containing the values of , , , and for that day.
Output Specification
Output one line with characters. The -th character should be Y
if Walf can wear the same color hat and shirt on Day and N
if he can't.
Sample Input
5 3
3 5 2 1 4
5 2 1 4 3
1 5 1 5
1 2 3 5
1 3 3 4
Sample Output
YYN
Comments