Dear contestant, now you are an excellent navy commander, who is responsible of a tough mission currently.
Your fleet unfortunately encountered an enemy fleet near the South Pole where the geographical conditions are negative for both sides. The floating ice and iceberg blocks battleships move which leads to this unexpected engagement highly dangerous, unpredictable and incontrollable.
But, fortunately, as an experienced navy commander, you are able to take opportunity to embattle the ships to maximize the utility of cannons on the battleships before the engagement.
The target is, arrange as many battleships as you can in the map. However, there are three rules so that you cannot do that arbitrary:
A battleship cannot lay on floating ice
A battleship cannot be placed on an iceberg
Two battleships cannot be arranged in the same row or column, unless one or more icebergs are in the middle of them.
There is only one integer T (0<T<12) at the beginning line, which means following T test cases.
For each test case, two integers m and n (1 <= m, n <= 50) are at the first line, represents the number of rows and columns of the battlefield map respectively. Following m lines contains n characters iteratively, each character belongs to one of ‘#’, ‘*’, ‘o’, that symbolize iceberg, ordinary sea and floating ice.
For each case, output just one line, contains a single integer which represents the maximal possible number of battleships can be arranged.
给定一个 #M \times N# 的地图，其中每个位置有三种可能情况：冰山、浮冰和普通海面。现在需要你在普通海面上布置战列舰，每个战列舰上的炮可以覆盖这一格所在的行和列，而冰川会挡住炮，使炮不能覆盖冰川后的地图，求需要多少战列舰才可以火力覆盖整个图。
输入数据一共 组测试数据，每组数据第一行包含 和 ，接下来 行，每行包括 个字符，