I met this problem as a subproblem many times and tried to find a solution for it but failed ,So I make an elegent statement for ↵
[Your text to linkThe problem is here... ](/predownloaded/b2/d8/b2d822438819a8d48ef27c7945e3e1026180f088.png)↵
/predownloaded/94/5d/945d1b0883127729b4bbb84faebda0f74566233a.png↵
↵
Example :↵
Input :↵
3 4↵
5 7 8 9↵
1 5↵
4 5 7 9 8↵
3 9 7 8↵
Output :↵
YES↵
5 7 8↵
Input :↵
3 4↵
5 7 8 9↵
1 5↵
2 5 7↵
1 7↵
Output :↵
NO↵
[
/predownloaded/94/5d/945d1b0883127729b4bbb84faebda0f74566233a.png↵
↵
Example :↵
Input :↵
3 4↵
5 7 8 9↵
1 5↵
4 5 7 9 8↵
3 9 7 8↵
Output :↵
YES↵
5 7 8↵
Input :↵
3 4↵
5 7 8 9↵
1 5↵
2 5 7↵
1 7↵
Output :↵
NO↵