P24749 [AtCoder] Piano 2
入门
题目描述

Problem Statement

You are given $a sequence A=(A_1,A_2,\dots,A_N)$ of length N and $a sequence B=(B_1,B_2,\dots,B_M)$ of length M. Here, all elements of A and B are pairwise distinct. Determine whether the sequence $C=(C_1,C_2,\dots,C_{N+M})$ formed by sorting all elements of A and B in ascending order contains two consecutive elements appearing in A.

Input

The input is given from Standard Input in the following format:
N M
$A_1 A_2 \dots A_N$
$B_1 B_2 \dots B_M$

Output

If C contains two consecutive elements appearing in A, print Yes; otherwise, print No.

Constraints

  • $1 \leq N, M \leq 100$
  • $1 \leq A_i, B_j \leq 200$
  • $A_1, A_2, \dots, A_N, B_1, B_2, \dots, B_M$ are distinct.
  • All input values are integers.

Sample Input 1

3 2
3 2 5
4 1

Sample Output 1

Yes

C=(1,2,3,4,5). Since 2 and 3 from A occur consecutively in C, print Yes.

Sample Input 2

3 2
3 1 5
4 2

Sample Output 2

No

C=(1,2,3,4,5). Since no two elements from A occur consecutively in C, print No.

Sample Input 3

1 1
1
2

Sample Output 3

No

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 2 3 2 5 4 1
样例输出
Yes