A. Bridge Day
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
3 7
31 28 31
1 1
3 1
28 1
29 1
30 1
1 2
30 3
Output
YA
Input
6 8
31 28 31 30 31 30
1 1
17 2
18 2
21 3
3 4
1 5
27 5
31 5
Output
TIDAK