https://cses.fi/problemset/task/2190/
Input Format
Check Link
Output Format
Check Link
Constraints
Check Link
Example
Input
5 1 1 5 3 1 2 4 3 1 1 5 3 1 1 4 3 1 1 5 3 2 3 4 1 1 1 5 3 2 4 4 1 1 1 5 3 3 2 7 4
Output
NO YES YES YES YES