OFFSIDE - He is offside!

题意翻译

多组数据 当$n,m$均为$0$时结束 输入 $n,m$ 分别代表进攻队员与防守队员数量 输入$n$个数每个数代表进攻队员与门线的距离 输入$m$个数每个数代表防守队员与门线的距离 如果有人越位 输出$Y$ 否则输出$N$ **越位** 指进攻队员距门线的距离小于倒数第二个防守队员距门线的距离

题目描述

Hemisphere Network is the largest television network in Tumbolia, a small country located east of South America (or south of East America). The most popular sport in Tumbolia, unsurprisingly, is soccer; many games are broadcast every week in Tumbolia. Hemisphere Network receives many requests to replay dubious plays; usually, these happen when a player is deemed to be offside by the referee. An attacking player is _offside_ if he is nearer to his opponents’ goal line than the second last opponent. A player is not offside if - he is level with the second last opponent or - he is level with the last two opponents. Through the use of computer graphics technology, Hemisphere Network can take an image of the field and determine the distances of the players to the defending team’s goal line, but they still need a program that, given these distances, decides whether a player is offside.

输入输出格式

输入格式


The input file contains several test cases. The first line of each test case contains two integers A and D separated by a single space indicating, respectively, the number of attacking and defending players involved in the play (2 <= A,D <= 11). The next line contains A integers B $ _{i} $ separated by single spaces, indicating the distances of the attacking players to the goal line (1 <= B $ _{i} $ <= 10 $ ^{4} $ ). The next line contains D integers C $ _{j} $ separated by single spaces, indicating the distances of the defending players to the goal line (1 <= C $ _{j} $ <= 10 $ ^{4} $ ). The end of input is indicated by A = D = 0.

输出格式


For each test case in the input print a line containing a single character: “Y” (uppercase) if there is an attacking player offside, and “N” (uppercase) otherwise.

输入输出样例

输入样例 #1

2 3
500 700
700 500 500
2 2
200 400
200 1000
3 4
530 510 490
480 470 50 310
0 0

输出样例 #1

N
Y
N