public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int cases=scanner.nextInt();
        while (cases-->0){
            int r=scanner.nextInt(),c=scanner.nextInt();
            init(r,c);
            for(int i=0;i<r;++i){
                for(int j=0;j<c;++j){
                    layout[i][j]=scanner.nextInt();
                }
            }
            System.out.println(entrance());
        }
    }