#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define INF (1<<24)
 
bool isNum(char ch){return ('0'<=ch&&ch<='9');}
 
struct calcStr{
  string s;
  int pos,len;
  bool flag;
 
  void init(){ pos=0;len=s.size();flag=false;}
 
  int head2Num(){
    if(pos+1<len&&s[pos]=='0'&&isNum(s[pos+1]))flag=true;
    int res=0;
    while(pos<len){
      if(isNum(s[pos])){
    res*=10;
    res+=(s[pos]-'0');
    pos++;
      }else break;
    }
    return res;
  }
   
  int getNum(){
    int res=head2Num(),num;
    char ch;
    while(s[pos]=='*'||s[pos]=='/'){
      ch=s[pos++];
      num=head2Num();
      if(ch=='*')res*=num;
      else if(ch=='/'){
    if(num==0){flag=true;num=1;}
    if(res%num>0)flag=true;
    res/=num;
      }
    }
    return res;
  }
   
  int getAns(){
    if(!isNum(s[0]))return INF;
    for(int i=1;i+1<len;i++)if(!isNum(s[i-1])&&!isNum(s[i]))return INF;
 
    int res=getNum(),num;
    while(1){
      if(s[pos]=='=')break;
      char ch=s[pos++];
      num=getNum();
      if(ch=='+')res+=num;
      else if(ch=='-')res-=num;
    }
    if(flag)return INF;
    else return res;
  }
};
 
int H,W,N,M,e;
string str;
string v;
char t[100][100];
char u[100];
vector<string> w,w2;
 
bool solve();
bool check();
bool compute(int);
 
int main(){
  while(1){
    cin>>H>>W;
    if(H==0&&W==0)break;
    M=0;
    w.clear();
    for(int i=0;i<H;i++){
      cin>>str;
      for(int j=0;j<W;j++){
    t[i][j]=str[j];
    if(t[i][j]=='.'){
      t[i][j]='A'+M;
      M++;
    }
      }
    }
    cin>>N;
    for(int i=0;i<N;i++)cin>>u[i];
     
    string tmp;
    for(int i=0;i<H;i++){
      tmp="";
      for(int j=0;j<W;j++){
    if(t[i][j]=='=')e=j;
    if(t[i][j]=='#'){
      if(tmp.size()>=3&&e>0&&e+1<tmp.size()){
        w.push_back(tmp.substr(0,e));
        w2.push_back(tmp.substr(e+1));
      }
      tmp="";
    }else tmp.push_back(t[i][j]);
      }
      if(tmp.size()>=3&&e>0&&e+1<tmp.size()){
    w.push_back(tmp.substr(0,e));
    w2.push_back(tmp.substr(e+1));
      }
    }
     
    for(int i=0;i<W;i++){
      tmp="";
      for(int j=0;j<H;j++){
    if(t[j][i]=='=')e=j;
    if(t[j][i]=='#'){
      if(tmp.size()>=3&&e>0&&e+1<tmp.size()){
        w.push_back(tmp.substr(0,e));
        w2.push_back(tmp.substr(e+1));
      }
      tmp="";
    }else tmp.push_back(t[j][i]);
      }
      if(tmp.size()>=3&&e>0&&e+1<tmp.size()){
    w.push_back(tmp.substr(0,e));
    w2.push_back(tmp.substr(e+1));
      }
    }
 
    cout<<(solve()?"Yes":"No")<<endl;
  }
  return 0;
}
 
bool solve(){
  sort(u,u+N);
  do{
    if(check())return true;
  }while(next_permutation(u,u+N));
  return false;
}
 
bool check(){
  for(int i=0;i<(int)w.size();i++)if(!compute(i))return false;
  return true;
}
 
bool compute(int x){
  calcStr a,b;
  a.s="";
  b.s="";
  for(int i=0;i<(int)w[x].size();i++){
    if('A'<=w[x][i]&&w[x][i]<='Z')a.s.push_back(u[w[x][i]-'A']);
    else a.s.push_back(w[x][i]);
  }
  for(int i=0;i<(int)w2[x].size();i++){
    if('A'<=w2[x][i]&&w2[x][i]<='Z')b.s.push_back(u[w2[x][i]-'A']);
    else b.s.push_back(w2[x][i]);
  }

  a.s.push_back('=');
  b.s.push_back('=');
  a.init();
  b.init();
  int A=a.getAns();
  int B=b.getAns();
  if(A==INF||B==INF)return false;
  return (A==B);
}