### global variables

$pos = 0
$expcache = {}

### subroutines

## <exp> := <md> (('+'|'-') <md>)*
## <md> := <num> (('*'|'/') <num>)*
## <num> := '0' | ('1'-'9')('0'-'9')*

def parse_num(exp)
  #puts "parse_num: #{exp}, #{$pos}"

  str = ''
  ch = exp[$pos]
  while ! ch.nil? && ch >= '0' && ch <= '9'
    str += ch
    $pos += 1
    ch = exp[$pos]
  end

  return nil if str == '' || (str.length >= 2 && str[0] == '0')
  str.to_i
end

def parse_md(exp)
  #puts "parse_md: #{exp}, #{$pos}"

  val = parse_num(exp)
  return nil if val.nil?

  ch = exp[$pos]
  while ! ch.nil? && (ch == '*' || ch == '/')
    $pos += 1
    val0 = parse_num(exp)
    return nil if val0.nil?

    if ch == '*'
      val *= val0
    else
      return nil if val0 == 0 || val % val0 != 0
      val /= val0
    end

    ch = exp[$pos]
  end

  val
end

def parse_exp(exp)
  #puts "parse_exp: #{exp}, #{$pos}"

  val = parse_md(exp)
  return nil if val.nil?

  ch = exp[$pos]
  while ! ch.nil? && (ch == '+' || ch == '-')
    #puts "parse_exp: #{exp}[#{$pos}] = #{ch}"

    $pos += 1
    val0 = parse_md(exp)
    return nil if val0.nil?

    if ch == '+'
      val += val0
    else
      val -= val0
    end

    ch = exp[$pos]
  end

  val
end

def eval_exp(exp)
  #return $expcache[exp] if ! $expcache[exp].nil?

  $pos = 0
  val = parse_exp(exp)

  #$expcache[exp] = ($pos == exp.length) ? val : nil
  ($pos == exp.length) ? val : nil
end

def is_valid_eqn?(eqn)
  exps = eqn.split('=')
  return false if exps.length != 2

  val0 = eval_exp(exps[0])
  val1 = eval_exp(exps[1])

  ! val0.nil? && ! val1.nil? && val0 == val1
end

def check_rec(k)
  return true if k >= $n

  for d in (0...$n)
    next if $used[d]

    $used[d] = true
    $mtx[$blanks[k]] = $cands[d]
    ok = true

    for i in $eqnbls[k]
      eqnstr = $eqns[i].map{|j| $mtx[j]}.join
      ok = is_valid_eqn?(eqnstr)
      break if ! ok
    end

    if ok
      ok = check_rec(k + 1)
    end

    $mtx[$blanks[k]] = '.'
    $used[d] = false

    return true if ok
  end    

  false
end

### main

loop do
  $h, $w = gets.split.map(&:to_i)
  break if $h == 0 && $w == 0

  hw = $h * $w

  $mtx = []

  $h.times do
    $mtx += gets.strip.split('')
  end
  #p $mtx

  $eqns = []

  for y in (0...$h)
    x = 0
    while x < $w
      x0 = x
      eqn = []
      while x0 < $w && $mtx[y * $w + x0] != '#'
        eqn << y * $w + x0
        x0 += 1
      end
      $eqns << eqn if eqn.length > 1
      x = x0 + 1
    end
  end

  for x in (0...$w)
    y = 0
    while y < $h
      y0 = y
      eqn = []
      while y0 < $h && $mtx[y0 * $w + x] != '#'
        eqn << y0 * $w + x
        y0 += 1
      end
      $eqns << eqn if eqn.length > 1
      y = y0 + 1
    end
  end
  #$eqns.each{|e| p e.map{|i| $mtx[i]}.join}

  $blanks = []
  $mtx.each_with_index{|c, i|  $blanks << i if c == '.'}
  #p $blanks

  $n = gets.to_i
  $cands = gets.split
  #p cands

  $eqnbls = $n.times.map{[]}
  for i in (0...$eqns.length)
    blpos = $eqns[i].select{|pos| $mtx[pos] == '.'}.max
    if ! blpos.nil?
      $eqnbls[$blanks.index(blpos)] << i
    end
  end
  #p $eqnbls

  $used = $n.times.map{false}

  ok = check_rec(0)

  puts (ok ? 'Yes' : 'No')
end