private static String solve(char[][] x, int N) {
        for (int i = 0; i < N; i++) 
            for (int j = 0; j < N; j++) 
                if (x[i][j] == '#') {  
                    if (!remove(x, N, i, j)) return "NO";
                    if (!remove(x, N, i+1, j-1)) return "NO";
                    if (!remove(x, N, i+1, j)) return "NO";
                    if (!remove(x, N, i+1, j+1)) return "NO";
                    if (!remove(x, N, i+2, j)) return "NO";
                }
        
        return "YES";
    }