tThe first line of the input is an integer T which indicates the number of test cases.Each of the cases tells the map of the sea base you will explore, The first line will be the M, N, K, P. M (1 ??? M ??? 20) is the width of the area, N (1 ??? N ??? 20) is the length of the area, and K (1 ??? K ??? 10) is the number of kinds of resource, P is the certain capacity of the battery.Then follows M lin