In Mynerva, there are
Input
The first line contains
The next
The next line contains
The next White
or Black
, representing their color.
Constraints
Output
For each of the
Note: it will always be possible for each animal to reach their destination.
Sample Input
5 7
4 1 7
5 2 1
5 3 9
5 4 5
1 5 1
3 1 8
3 4 6
5
2 Black
5 Black
3 Black
3 White
1 White
Sample Output
2 2
1 1
1 8
1 8
0 0
Comments
Underrated Problem
2021/8/24: I just realized that wasn't a compliment :peepokms: