Finding Black Circles

There are some black circles completely drawn on a white paper. Given the digital image of the paper, could you find the circles? The width and height of the digital image are w and h pixels. Each pixel is a 1 × 1 square. The center of the top-left pixel is (0, 0) and the center of the bottom-right pixel is (w − 1, h − 1). For each circle, the center coordinates and the radius are all integers. If a circle passes through a pixel (merely touching its border is not considered passing), the pixel is rendered black (1), otherwise it is white (0). Due to noises, at most 2% black pixels might become white. No white pixels will become black. Input The first line contains the number of test cases T (T ≤ 20). Each test case begins with two integers w and h (30 ≤ w, h ≤ 100). The following h lines contain the digital image. There will be at least one and at most five circles. The radius of each circle will be at least 5. The judge input will be carefully chosen to avoid ambiguities and confusions. Output For each test case, print the number of circles k, and k tuples ‘(r,x,y)’, each describing a circle centered at (x, y) with radius r. Tuples should be sorted lexicographically (first r, then x, and then y). Sample Input 1 30 30 000000000000000000000000000000 000000000000011111110000000000 000000000000110000011000000000 000000000001100000001100000000 000000000011000000000110000000 000000000110000000000011000000 000000011111110000000001000000 000001110100011100000001000000 000011000100000110000000000000 000110000100000011000001000000 001100000100000001100001000000 001000000110000000100011000000 011000000011000000110110000000 010000000001100000011100000000 010000000000110000011000000000 010000000000011111110000000000 010000000000000000010000000000 010000000000000000010000000000 011000000000000000110000000000 001000000000000000100000000000 001000000000000001100000000000 000110000000000011000000000000

2/2 000011000000000110000000000000 000001110000011100000000000000 000000011111110000000000000000 000000000000000000000000000000 000000000000000000000000000000 000000000000000000000000000000 000000000000000000000000000000 000000000000000000000000000000 Sample Output Case 1: 2 (7,16,8) (9,10,15)