Medium Game Theory > Observations/Pattern finding

Given an **n x m** chessboard. At location **(x,y)** (x is the row number and y is the column number) a white Knight is placed. You have to put minimum number of black Knights in the chessboard so that white knight can not move. If white knight just do a single move, one of your black knights can capture that knights in the next move. Those who are not familiar with chess knights , note chess knight can attack and move 8 position in the board as shown in the picture below. ![enter image description here][1] Input: ------ Input starts with an integer **T (1<=2000)**, denoting the number of test cases. Each case contains four integer **n,m ,x,y(4≤n,m≤1000 and 1≤x≤n and 1≤y≤m)** which described above. Output: ------- For each test case output one line Like **"Case X: Y"** without any quote where X is the case number and Y is the answer of the problem. Sample Input ------------ 1 10 10 5 5 Sample Output ------------- Case 1: 4 [1]: https://s3-ap-southeast-1.amazonaws.com/devskillimagestorage/questionimages/cd7a81ce-be03-c539-25d7-08d4c47e8c13_d177dee451aa4be2a188df0c037037d9_W553xH554.jpg

Suman Bhadra