#include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<cmath>
#include<cstdio>
#include<cstring>
using namespace std;
char a[13][13],e[10];
map<pair<int,int>,int> b,c;
vector<pair<int,int> > d;
int f[10],n;
bool fj(int x,int y,int dx,int dy){
  int i,j;
  string s;
  for(i=0;a[y+dy*i][x+dx*i]!='#';++i)
    s+=a[y+dy*i][x+dx*i];
  int ln=s.length();
  vector<pair<int,char> > h;
  for(i=0;i<ln;i=j+1){
    for(j=i+1;j<ln&&'0'<=s[j]&&s[j]<='9';++j);
    string t=s.substr(i,j-i);
    if(j-i>1&&t[0]=='0')
      return false;
    h.push_back(make_pair(atoi(t.c_str()),'\0'));
    if(j<ln)
      h.push_back(make_pair(0,s[j]));
  }
  for(i=0;i<(int)h.size();++i){
    if(h[i].second=='*'){
      h[i-1].first*=h[i+1].first;
      h.erase(h.begin()+i,h.begin()+i+2);
      i-=2;
    }
    if(h[i].second=='/'){
      if(h[i+1].first==0||h[i-1].first%h[i+1].first)
	return false;
      h[i-1].first/=h[i+1].first;
      h.erase(h.begin()+i,h.begin()+i+2);
      i-=2;
    }
  }
  for(i=0;i<(int)h.size();++i){
    if(h[i].second=='+'){
      h[i-1].first+=h[i+1].first;
      h.erase(h.begin()+i,h.begin()+i+2);
      i-=2;
    }
    if(h[i].second=='-'){
      h[i-1].first-=h[i+1].first;
      h.erase(h.begin()+i,h.begin()+i+2);
      i-=2;
    }
  }
  return h[0].first==h[2].first;
}
bool fi(int p){
  int i;
  if(p==n)
    return true;
  map<pair<int,int>,int>::iterator it=b.end(),jt=c.end();
  bool g=false;  
  for(i=0;a[d[p].first][d[p].second-i-1]!='#';++i);
  if(b.count(make_pair(d[p].first,d[p].second-i))){
    it=b.lower_bound(make_pair(d[p].first,d[p].second-i));
    --(*it).second;
    if(!(a[d[p].first][d[p].second-1]=='.'||('0'<=a[d[p].first][d[p].second-1]&&a[d[p].first][d[p].second-1]<='9'))||
       !(a[d[p].first][d[p].second+1]=='.'||('0'<=a[d[p].first][d[p].second+1]&&a[d[p].first][d[p].second+1]<='9')))
      g=true;
  }
  for(i=0;a[d[p].first-i-1][d[p].second]!='#';++i);
  if(c.count(make_pair(d[p].first-i,d[p].second))){
    jt=c.lower_bound(make_pair(d[p].first-i,d[p].second));
    --(*jt).second;
    if(!(a[d[p].first-1][d[p].second]=='.'||('0'<=a[d[p].first-1][d[p].second]&&a[d[p].first-1][d[p].second]<='9'))||
       !(a[d[p].first+1][d[p].second]=='.'||('0'<=a[d[p].first+1][d[p].second]&&a[d[p].first+1][d[p].second]<='9')))
      g=true;
  }
  for(i=0;i<n;++i){
    if(f[i]||(g&&('0'>e[i]||e[i]>'9')))
      continue;
    a[d[p].first][d[p].second]=e[i];
    if((it!=b.end()&&!(*it).second&&!fj((*it).first.second,(*it).first.first,1,0))||
       (jt!=c.end()&&!(*jt).second&&!fj((*jt).first.second,(*jt).first.first,0,1)))
      continue;
    f[i]=-1;    
    if(fi(p+1))    
      return true;
    f[i]=0;
  }
  a[d[p].first][d[p].second]='.';
  if(it!=b.end())
    ++(*it).second;
  if(jt!=c.end())
    ++(*jt).second;
  return false;
}
int main(){
  int i,j,k;
  int h,w;
  while(cin>>h>>w,h||w){
    //char a[13][13];
    for(i=0;i<13;++i)
      for(j=0;j<13;++j)
	a[i][j]='#';
    for(i=1;i<=h;++i){
      cin>>&a[i][1];
      for(j=0;a[i][j];++j);
      a[i][j]='#';
    }
    //map<pair<int,int>,int> b,c;
    //vector<pair<int,int> > d;
    b.clear();
    c.clear();
    d.clear();
    for(i=1;i<=h;++i){
      for(j=1;j<=w;++j){
	if(a[i][j]=='#')
	  continue;
	if(a[i][j-1]=='#'&&a[i][j+1]!='#'&&a[i][j+2]!='#')
	  b[make_pair(i,j)]=0;
	if(a[i-1][j]=='#'&&a[i+1][j]!='#'&&a[i+2][j]!='#')
	  c[make_pair(i,j)]=0;
	if(a[i][j]=='.'){
	  for(k=0;a[i][j-k-1]!='#';++k);
	  if(b.count(make_pair(i,j-k)))
	    ++b[make_pair(i,j-k)];
	  for(k=0;a[i-k-1][j]!='#';++k);
	  if(c.count(make_pair(i-k,j)))
	    ++c[make_pair(i-k,j)];
	  d.push_back(make_pair(i,j));
	}
      }
    }
    //int n;
    cin>>n;
    //char e[10];
    for(i=0;i<n;++i)
      cin>>e[i];
    //int f[10];
    memset(f,0,sizeof(f));
    if(fi(0))
      cout<<"Yes"<<endl;
    else
      cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 936