시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
5 초 512 MB 0 0 0 0.000%

문제

Long ago, an alien civilization built a giant monument. The floor of the monument looked like this:

###############
#.............#
#.###########.#
#.#.........#.#
#.#.#######.#.#
#.#.#.....#.#.#
#.#.#.###.#.#.#
#.#.#.#.#.#.#.#
#.#.#.###.#.#.#
#.#.#.....#.#.#
#.#.#######.#.#
#.#.........#.#
#.###########.#
#.............#
###############


Each '#' represents a red tile, and each '.' represents a blue tile. The pattern went on for miles and miles (you may, for the purposes of the problem, assume it was infinite). Today, only a few of the tiles remain. The rest have been damaged by methane rain and dust storms. Given the locations and colours of the remaining tiles, can you find the center of the pattern?

입력

The first line of the input gives the number of test cases, TT test cases follow. Each one starts with a line containing N, the number of remaining tiles. The next N lines each contain XiYi, and the tile colour (either '#' or '.').

Limits

• 1 ≤ T ≤ 50.
• The list of coordinates in each test case will not contain duplicates.
• 1 ≤ N ≤ 100.
• -100 ≤ Xi ≤ 100.
• -100 ≤ Yi ≤ 100.

출력

For each test case, output one line containing "Case #c: X Y", where c is the case number (starting from 1) and (XY) is the location of the center of the pattern. If there is more than one possible answer, output the (XY) closest to (0, 0) in Manhattan distance (the distance in x, plus the distance in y). If there are still ties, output the one with the largest X. If there are still ties after that, output the one with the largest Y. If there is no possible answer, output "Case #c: Too damaged".

예제 입력 1

6
1
0 0 .
1
0 0 #
3
0 0 #
0 1 #
1 0 #
5
50 30 #
49 30 #
49 31 #
49 32 #
50 32 #
2
-98 0 #
99 50 .
4
88 88 .
88 89 .
89 88 .
89 89 .


예제 출력 1

Case #1: 0 0
Case #2: 1 0
Case #3: 1 1
Case #4: 50 31
Case #5: 1 0
Case #6: Too damaged