C.S.I.: P15

No attempts yetTime limit1sMemory limit256 MB

Problem

You have been cast as the computer genius who cracks the case in the season finale of C.S.I.: P15. As expected, a camera feed shows up that needs to be analyzed. The camera records in HD-9000 quality with extra regression, the stream is then matched inside the camera by a re-inverted isomorphic bit coefficient matrix and plasma shifted five times for good measure. You view the feed through Netscape Navigator 4 Platinum Edition.

The trouble is that a saboteur switched the camera into ASCII mode and into picture burst mode. All you have left is a pile of still ASCII images. For reasons the show reveals later, you have to design and implement a deterministic algorithm that counts the flowers and the birds in one still image.

The rules of an image are these.

  • Air is a . (a dot).
  • The ground is the last line of the image and holds = characters only. Nothing else ever appears on that line.
  • Two cells are 8-connected when they share an edge or a corner.
  • A flower is an 8-connected component of cells taken from |, /, \, -, @ that is connected to the ground. A component is connected to the ground when one of its cells is 8-adjacent to a = cell of the last line.
  • A bird is an occurrence of /\/\ inside a single line whose four cells are surrounded exclusively by air, or by the edges of the image.

So something that looks like a bird but sits on the ground is a flower. It may be an ex-parrot, but here it counts as a flower too.

Input

The first line holds one integer TT, the number of test cases. Each test case begins with a line of two integers separated by a space, the height HH and the width WW, and continues with HH lines describing the picture. Each line of the picture has exactly WW characters. All lines but the last consist of ., |, /, \, -, @ only, and the last line consists of = only.

  • 0<T1000 < T \le 100
  • 0<W300 < W \le 30
  • 0<H300 < H \le 30

Output

For each test case, print two lines. If the number of flowers is FF and the number of birds is BB, print

Flowers: F
Birds: B