require 'set'

def bfs(a)
  reached = Set[[1, 1]]
  queue = [[1, 1]]
  until queue.empty? 
    i, j = queue.shift
    [[i + 1, j], [i - 1, j], [i, j + 1], [i, j - 1]].each do |y, x|
      next if a[y][x] == ?# or reached.include?([y, x])
      queue << [y, x]
      reached << [y, x]
    end
  end
  return reached
end

def lefthand(a)
  n, m = a.size - 2, a[0].size - 2
  y, x, dy, dx = 1, 1, 0, 1
  reached = Set[[1, 1]]
  path = [[1, 1]]
  loop do
    dy, dx = dx, -dy until a[y + dy][x + dx] == ?.
    y += dy
    x += dx
    if reached.include?([y, x])
      path.pop until path[-1] == [y, x]
    else
      reached << [y, x]
      path << [y, x]
    end
    break if y == n && x == m
    if a[y - dx][x + dy] == ?.
      dy, dx = -dx, dy
      y += dy
      x += dx
      reached << [y, x]
      path << [y, x]
      break if y == n && x == m
    end
  end
  path
end

def righthand(a)
  n, m = a.size - 2, a[0].size - 2
  y, x, dy, dx = 1, 1, 1, 0
  reached = Set[[1, 1]]
  path = [[1, 1]]
  loop do
    dy, dx = -dx, dy until a[y + dy][x + dx] == ?.
    y += dy
    x += dx
    if reached.include?([y, x])
      path.pop until path[-1] == [y, x]
    else
      reached << [y, x]
      path << [y, x]
    end
    break if y == n && x == m
    if a[y + dx][x - dy] == ?.
      dy, dx = dx, -dy
      y += dy
      x += dx
      reached << [y, x]
      path << [y, x]
      break if y == n && x == m
    end
  end
  path
end

loop do
  n, m = gets.split.map(&:to_i)
  break if n == 0
  a = [[?#] * (m + 2)] + (1..n).map { [?#] + gets.chomp.split("") + [?#] } + [[?#] * (m + 2)] 
  reached = bfs(a)
  if !reached.include?([1, m]) or !reached.include?([n, m]) or !reached.include?([n, 1])
    puts 'NO'
    next
  end
  path_l = lefthand(a)
  if !path_l.include?([1, m])
    puts 'NO'
    next
  end
  path_r = righthand(a)
  if !path_r.include?([n, 1])
    puts 'NO'
    next
  end
  answer = 'YES'
  path_l[1..-2].each do |y, x|
    if path_r.include?([y, x])
      answer = 'NO'
      break
    end
  end
  puts answer
end

