Safari Park

题目描述

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=602&page=show_problem&problem=4436 [PDF](https://uva.onlinejudge.org/external/126/p12698.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12698/8b958072ca3b37142a045197a8fcbccb1d98c047.png)

输入输出格式

输入格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12698/5fbf0b4573e038c6bc0df83a206d75acc6f2b9c6.png)

输出格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA12698/f556a88e5c944efc090b7d65ac65310cbc5bd182.png)

输入输出样例

输入样例 #1

1
10
R 0 0 0 5 5 0
R 10 10 10 5 5 10
Q 5 5
Q 1 1
Q 9 9
R -6 -4 -4 -6 -6 -6
Q -5 -5
Q 1 1
R 0 5 4 4 5 0
Q 3 3

输出样例 #1

Case 1:
0
1
2
-1
1
4