program main
  implicit none
  integer :: h,w,i,j
  integer,allocatable :: x(:,:)
  character(50) :: s

  read(*,*) h,w
  allocate(x(0:h+1,0:w+1))
  x(:,:)=0

  do i=1,h
     read(*,*) s
     do j=1,w
        if(s(j:j)=='#')then
           x(i,j)=1
        else
           x(i,j)=0
        endif
     enddo
  enddo

  do i=1,h
     do j=1,w
        if(x(i,j)==1)then
           if(x(i,j-1)==1)then
              cycle
           else if(x(i,j+1)==1)then
              cycle
           else if(x(i+1,j)==1)then
              cycle
           else if(x(i-1,j)==1)then
              cycle
           else
              write(*,*) 'No'
              stop
           endif
        endif
     enddo
  enddo

  write(*,*) 'Yes'

  stop

end program main
; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@_QFEs = internal global [50 x i8] undef
@_QFEx.0 = internal unnamed_addr global ptr null
@_QFEx.7 = internal unnamed_addr global i64 1
@_QFEx.8 = internal unnamed_addr global i64 0
@_QFEx.10 = internal unnamed_addr global i64 1
@_QQcl.a102e7f2e1951d2b48d2c9646e203b7b = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_6020/source.f\00"
@_QQcl.23 = linkonce constant [1 x i8] c"#"
@_QQcl.4E6F = linkonce constant [2 x i8] c"No"
@_QQcl.596573 = linkonce constant [3 x i8] c"Yes"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.a102e7f2e1951d2b48d2c9646e203b7b, i32 7)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %1, i32 4)
  %5 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 4)
  %6 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %7 = load i32, ptr %1, align 4, !tbaa !3
  %8 = add i32 %7, 1
  %9 = load i32, ptr %2, align 4, !tbaa !3
  %10 = add i32 %9, 1
  %11 = call i32 @llvm.smax.i32(i32 %8, i32 -1)
  %12 = sext i32 %11 to i64
  %13 = add nsw i64 %12, 1
  %14 = call i32 @llvm.smax.i32(i32 %10, i32 -1)
  %15 = sext i32 %14 to i64
  %16 = add nsw i64 %15, 1
  %17 = shl nuw nsw i64 %13, 2
  %18 = mul i64 %17, %16
  %19 = call ptr @malloc(i64 %18)
  %20 = icmp eq i64 %13, 0
  %21 = zext i1 %20 to i64
  %22 = icmp eq i64 %16, 0
  %23 = zext i1 %22 to i64
  store ptr %19, ptr @_QFEx.0, align 8, !tbaa !7
  store i64 %21, ptr @_QFEx.7, align 8, !tbaa !7
  store i64 %13, ptr @_QFEx.8, align 8, !tbaa !7
  store i64 %23, ptr @_QFEx.10, align 8, !tbaa !7
  %24 = icmp sgt i32 %10, -1
  %25 = icmp sgt i32 %8, -1
  %or.cond = select i1 %24, i1 %25, i1 false
  br i1 %or.cond, label %.preheader.us.preheader, label %._crit_edge306

.preheader.us.preheader:                          ; preds = %0
  %26 = shl nsw i64 %12, 2
  %27 = add nsw i64 %26, 4
  %28 = add nsw i64 %12, 2
  %smin = call i64 @llvm.smin.i64(i64 %13, i64 1)
  %29 = sub nuw nsw i64 %28, %smin
  %30 = shl nuw nsw i64 %29, 2
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %.preheader.us
  %31 = phi i64 [ %35, %.preheader.us ], [ %16, %.preheader.us.preheader ]
  %32 = phi i64 [ %34, %.preheader.us ], [ 0, %.preheader.us.preheader ]
  %33 = mul i64 %27, %32
  %uglygep = getelementptr i8, ptr %19, i64 %33
  call void @llvm.memset.p0.i64(ptr align 4 %uglygep, i8 0, i64 %30, i1 false), !tbaa !3
  %34 = add nuw nsw i64 %32, 1
  %35 = add nsw i64 %31, -1
  %36 = icmp ugt i64 %31, 1
  br i1 %36, label %.preheader.us, label %._crit_edge306

._crit_edge306:                                   ; preds = %.preheader.us, %0
  %37 = icmp sgt i32 %7, 0
  br i1 %37, label %.lr.ph308.preheader, label %._crit_edge319

.lr.ph308.preheader:                              ; preds = %._crit_edge306
  %38 = zext i32 %7 to i64
  br label %.lr.ph308

.lr.ph308:                                        ; preds = %.lr.ph308.preheader, %._crit_edge
  %indvars.iv323 = phi i64 [ 1, %.lr.ph308.preheader ], [ %indvars.iv.next324, %._crit_edge ]
  %39 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.a102e7f2e1951d2b48d2c9646e203b7b, i32 12)
  %40 = call i1 @_FortranAioInputAscii(ptr %39, ptr nonnull @_QFEs, i64 50)
  %41 = call i32 @_FortranAioEndIoStatement(ptr %39)
  %42 = load i32, ptr %2, align 4, !tbaa !3
  %43 = icmp sgt i32 %42, 0
  br i1 %43, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph308
  %44 = zext i32 %42 to i64
  br label %45

45:                                               ; preds = %.lr.ph, %45
  %indvars.iv = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next, %45 ]
  %46 = add nsw i64 %indvars.iv, -1
  %47 = getelementptr [50 x [1 x i8]], ptr @_QFEs, i64 0, i64 %46
  %48 = call i32 @_FortranACharacterCompareScalar1(ptr %47, ptr nonnull @_QQcl.23, i64 1, i64 1)
  %49 = icmp eq i32 %48, 0
  %.unpack290 = load ptr, ptr @_QFEx.0, align 8, !tbaa !7
  %.unpack297.unpack.unpack = load i64, ptr @_QFEx.7, align 8, !tbaa !7
  %.unpack297.unpack.unpack300 = load i64, ptr @_QFEx.8, align 8, !tbaa !7
  %.unpack297.unpack298.unpack = load i64, ptr @_QFEx.10, align 8, !tbaa !7
  %50 = sub i64 %indvars.iv323, %.unpack297.unpack.unpack
  %51 = sub i64 %indvars.iv, %.unpack297.unpack298.unpack
  %52 = mul i64 %51, %.unpack297.unpack.unpack300
  %53 = add i64 %50, %52
  %54 = getelementptr i32, ptr %.unpack290, i64 %53
  %. = zext i1 %49 to i32
  store i32 %., ptr %54, align 4, !tbaa !3
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %44
  br i1 %exitcond.not, label %._crit_edge, label %45

._crit_edge:                                      ; preds = %45, %.lr.ph308
  %indvars.iv.next324 = add nuw nsw i64 %indvars.iv323, 1
  %exitcond326.not = icmp eq i64 %indvars.iv323, %38
  br i1 %exitcond326.not, label %._crit_edge309, label %.lr.ph308

._crit_edge309:                                   ; preds = %._crit_edge
  %.pre = load i32, ptr %1, align 4, !tbaa !3
  %55 = icmp sgt i32 %.pre, 0
  br i1 %55, label %.lr.ph318, label %._crit_edge319

.lr.ph318:                                        ; preds = %._crit_edge309
  %56 = load i32, ptr %2, align 4, !tbaa !3
  %57 = icmp sgt i32 %56, 0
  %.unpack = load ptr, ptr @_QFEx.0, align 8
  %.unpack265.unpack.unpack = load i64, ptr @_QFEx.7, align 8
  %.unpack265.unpack.unpack268 = load i64, ptr @_QFEx.8, align 8
  %.unpack265.unpack266.unpack = load i64, ptr @_QFEx.10, align 8
  br i1 %57, label %.lr.ph313.us.preheader, label %._crit_edge319

.lr.ph313.us.preheader:                           ; preds = %.lr.ph318
  %58 = add nuw i32 %56, 1
  %wide.trip.count = zext i32 %58 to i64
  %59 = xor i64 %.unpack265.unpack266.unpack, -1
  br label %.lr.ph313.us

.lr.ph313.us:                                     ; preds = %.lr.ph313.us.preheader, %._crit_edge314.us
  %.0241316.us = phi i32 [ %62, %._crit_edge314.us ], [ 1, %.lr.ph313.us.preheader ]
  %60 = sext i32 %.0241316.us to i64
  %61 = sub i64 %60, %.unpack265.unpack.unpack
  %62 = add nuw i32 %.0241316.us, 1
  %63 = sext i32 %62 to i64
  %64 = sub i64 %63, %.unpack265.unpack.unpack
  %65 = add i32 %.0241316.us, -1
  %66 = sext i32 %65 to i64
  %67 = sub i64 %66, %.unpack265.unpack.unpack
  br label %68

68:                                               ; preds = %.lr.ph313.us, %101
  %indvars.iv327 = phi i64 [ 1, %.lr.ph313.us ], [ %indvars.iv.next328, %101 ]
  %69 = sub i64 %indvars.iv327, %.unpack265.unpack266.unpack
  %70 = mul i64 %69, %.unpack265.unpack.unpack268
  %71 = add i64 %70, %61
  %72 = getelementptr i32, ptr %.unpack, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !3
  %74 = icmp eq i32 %73, 1
  br i1 %74, label %75, label %101

75:                                               ; preds = %68
  %76 = add i64 %indvars.iv327, %59
  %77 = mul i64 %76, %.unpack265.unpack.unpack268
  %78 = add i64 %77, %61
  %79 = getelementptr i32, ptr %.unpack, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !3
  %81 = icmp eq i32 %80, 1
  br i1 %81, label %101, label %82

82:                                               ; preds = %75
  %83 = shl i64 %indvars.iv327, 32
  %sext = add i64 %83, 4294967296
  %84 = ashr exact i64 %sext, 32
  %85 = sub i64 %84, %.unpack265.unpack266.unpack
  %86 = mul i64 %85, %.unpack265.unpack.unpack268
  %87 = add i64 %86, %61
  %88 = getelementptr i32, ptr %.unpack, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !3
  %90 = icmp eq i32 %89, 1
  br i1 %90, label %101, label %91

91:                                               ; preds = %82
  %92 = add i64 %64, %70
  %93 = getelementptr i32, ptr %.unpack, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !3
  %95 = icmp eq i32 %94, 1
  br i1 %95, label %101, label %96

96:                                               ; preds = %91
  %97 = add i64 %67, %70
  %98 = getelementptr i32, ptr %.unpack, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !3
  %100 = icmp eq i32 %99, 1
  br i1 %100, label %101, label %.split.us

101:                                              ; preds = %96, %91, %82, %75, %68
  %indvars.iv.next328 = add nuw nsw i64 %indvars.iv327, 1
  %exitcond330.not = icmp eq i64 %indvars.iv.next328, %wide.trip.count
  br i1 %exitcond330.not, label %._crit_edge314.us, label %68

._crit_edge314.us:                                ; preds = %101
  %exitcond331.not = icmp eq i32 %.0241316.us, %.pre
  br i1 %exitcond331.not, label %._crit_edge319, label %.lr.ph313.us

.split.us:                                        ; preds = %96
  %102 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.a102e7f2e1951d2b48d2c9646e203b7b, i32 34)
  %103 = call i1 @_FortranAioOutputAscii(ptr %102, ptr nonnull @_QQcl.4E6F, i64 2)
  %104 = call i32 @_FortranAioEndIoStatement(ptr %102)
  %105 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

._crit_edge319:                                   ; preds = %._crit_edge314.us, %._crit_edge306, %.lr.ph318, %._crit_edge309
  %106 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.a102e7f2e1951d2b48d2c9646e203b7b, i32 41)
  %107 = call i1 @_FortranAioOutputAscii(ptr %106, ptr nonnull @_QQcl.596573, i64 3)
  %108 = call i32 @_FortranAioEndIoStatement(ptr %106)
  %109 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputInteger(ptr, ptr, i32) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare i1 @_FortranAioInputAscii(ptr, ptr, i64) local_unnamed_addr

declare i32 @_FortranACharacterCompareScalar1(ptr, ptr, i64, i64) local_unnamed_addr

declare ptr @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputAscii(ptr, ptr, i64) local_unnamed_addr

declare {} @_FortranAStopStatement(i32, i1, i1) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { noreturn }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!llvm.module.flags = !{!0, !1, !2}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!4, !4, i64 0}
!4 = !{!"any data access", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
!7 = !{!8, !8, i64 0}
!8 = !{!"descriptor member", !5, i64 0}
