Scanf.scanf "%d %d" (fun h w ->
    let s = Array.init h (fun _ -> Scanf.scanf " %s" (fun s -> s)) in
    let rec loop_y y =
        let rec loop_x x =
            if x = w then loop_y (y + 1) else
                if s.(y).[x] = '.' then loop_x (x + 1) else (
                    if x > 0     && s.(y).[x - 1] = '#' ||
                       x < w - 1 && s.(y).[x + 1] = '#' ||
                       y > 0     && s.(y - 1).[x] = '#' ||
                       y < h - 1 && s.(y + 1).[x] = '#' then loop_x (x + 1) else false
                )
        in
        if y = h then true else loop_x 0
    in
    print_endline @@ if loop_y 0 then "Yes" else "No"
)