I. Quarto
time limit per test
5 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
1
15
0 0 WRSO
0 1 BRSH
0 2 BRLO
0 3 WCSO
1 0 WRSH
1 1 BCSH
1 2 WRLO
1 3 WCLH
2 0 BCLH
2 1 WRLH
2 2 BCLO
2 3 BCSO
3 0 BRSO
3 2 WCSH
3 3 BRLH
WCLO
Output
1