~/algor $ cat problems/minmax-29-ikki-guruhni-solishtirish
Comparing two groups
Easy
1000 ms
128 MB
22%
A positive integer $N$ and $N$ integers $A_{i}$, and a positive integer $M$ and $M$ integers $B_{j}$ are given. Is every number of the first group strictly less than every number of the second group?
Input
The first line contains a positive integer $N$, the second — $N$ integers $A_{i}$, the third — a positive integer $M$, the fourth — $M$ integers $B_{j}$.
Output
One line: YES or NO.
Note
$1 \le N, M \le 1000$
$-10^{9} \le A_{i}, B_{j} \le 10^{9}$
Examples
Input #1
3 1 4 2 4 5 9 6 7
Output #1
YES
Input #2
2 3 8 3 6 10 7
Output #2
NO