{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"Walter White finally discovered the medicine for a dangerous disease. That\u0027s why he is in danger, because some people are targeting him to get the formula. So, now he and his co-workers have to leave the city.\n\nAssume that the city can be modeled as an **M x N** grid, where a cell containing a `*` means that a co-worker lives in that place, a cell containing a `.` means it\u0027s empty.\n\nSo, Walter informed all of them by phone to leave the city at once and he has laid down a rule that no one will cross path in their way out of the city. Since if two or more persons meet at same cell (even in the boundary cells), there is a big possibility that they all might get caught. Walter doesn\u0027t want that, so he needs to know whether all of them can get out of the city. So, he asked you to help him.\n\nFor simplicity, assume that if one person reaches any of the border cells of the grid, he is considered to be out of the city. And from any cell, a person can move only to its four adjacent cells (north, south, east or west).\n\n\n\n| ![][1] | ![][2] |\n| :----------------------------: | :-----------------: |\n| Fig 1: Position of the persons | Fig 2: Escape Paths |\n\n\n\nFor example, for the given 7 x 6 grid, the colored circles show the position of the persons who are escaping (fig 1). And a feasible solution is shown in fig 2.\n\n[1]: https://static.lightoj.com/images/problem-1405/escape1-1603144305035.png\n[2]: https://static.lightoj.com/images/problem-1405/escape2-1603144349812.png"}},{"title":"Input","value":{"format":"MD","content":"Input starts with an integer **T (\u0026le; 20)**, denoting the number of test cases.\n\nEach case starts with a line containing two integers **M** and **N (1 \u0026le; M, N \u0026le; 100)**. Each of the next **M** lines contains **N** characters denoting the map. Each character is either `.` or `*`. Total number of persons in a map will be at most **2 * (M+N)**."}},{"title":"Output","value":{"format":"MD","content":"For each case, print the case number and `yes` if it\u0027s possible for them to get out of the city maintaining the restrictions. Otherwise print `no`."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\n7 6\n..*...\n.*.*..\n..*.*.\n***..*\n.....*\n..**..\n....*.\n4 10\n***..***.*\n*.**.***.*\n..*..*..**\n.**.*.*.**\n4 10\n***..***.*\n*.**.***.*\n..*..*...*\n.**.*.*.**\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase 1: yes\nCase 2: no\nCase 3: yes\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}