D. Isomorphic Operations
time limit per test
4 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
8 7
ababcbdb
3 1 3 3
3 1 6 3
1 5 a
3 1 3 3
3 3 4 2
2 5 8
3 3 4 2
Output
TIDAK
YA
YA
YA
TIDAK