#include <bits/stdc++.h>
using namespace std;

#define dump(...) cout<<"# "<<#__VA_ARGS__<<'='<<(__VA_ARGS__)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	print_tuple<Cdr...>(os,t);
	os<<(sizeof...(Cdr)?",":"")<<get<sizeof...(Cdr)>(t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

tuple<int,int> number(const string& s,int i)
{
	int x=0;
	if(i>=s.size() || !isdigit(s[i])) return mt(INF,-1);
	for(int len=0;i<s.size() && isdigit(s[i]);i++,len++){
		if(len==1 && x==0) return mt(INF,-1);
		x=x*10+s[i]-'0';
	}
	return mt(x,i);
}
tuple<int,int> term(const string& s,int i)
{
	int x; tie(x,i)=number(s,i);
	if(i==-1) return mt(INF,-1);
	while(i<s.size() && (s[i]=='*' || s[i]=='/')){
		char op=s[i];
		int y; if(get<1>(tie(y,i)=number(s,i+1))==-1) return mt(INF,-1);
		if(op=='*') x*=y;
		if(op=='/'){
			if(y==0 || x%y>0) return mt(INF,-1);
			x/=y;
		}
	}
	return mt(x,i);
}
tuple<int,int> expr(const string& s,int i)
{
	int x; if(get<1>(tie(x,i)=term(s,i))==-1) return mt(INF,-1);
	while(i<s.size()){
		char op=s[i];
		if(op!='+' && op!='-') return mt(INF,-1);
		int y; if(get<1>(tie(y,i)=term(s,i+1))==-1) return mt(INF,-1);
		if(op=='+') x+=y;
		if(op=='-') x-=y;
	}
	return mt(x,i);
}

bool check(const vector<char*>& f)
{
	string s; for(char* p:f) s+=*p;
	if(count(all(s),'=')!=1) return false;
	int eq=s.find('=');
	if(eq==0 || eq==s.size()-1) return false;
	string a=s.substr(0,eq),b=s.substr(eq+1);
	auto x=get<0>(expr(a,0)),y=get<0>(expr(b,0));
	return x!=INF && y!=INF && x==y;
}

bool solve(int i,vs& grid,string& cs,const vi& is,const vi& js,const vector<vector<char*>>& fs,const vvi& ds)
{
	if(i==cs.size()) return true;
	
	for(char& c:cs) if(c!='X'){
		grid[is[i]][js[i]]=c; c='X';
		if(all_of(all(ds[i]),[&](int j){return check(fs[j]);}))
			if(solve(i+1,grid,cs,is,js,fs,ds))
				return true;
		c=grid[is[i]][js[i]];
	}
	return false;
}

int main()
{
	for(int h,w;cin>>h>>w && h|w;){
		vs grid(h);
		rep(i,h) cin>>grid[i];
		int n; cin>>n;
		string cs(n,'~');
		rep(i,n) cin>>cs[i];
		
		vi is,js;
		rep(i,h) rep(j,w) if(grid[i][j]=='.'){
			is.push_back(i);
			js.push_back(j);
		}
		vector<vector<char*>> fs;
		rep(i,h) rep(j,w) if(grid[i][j]!='#'){
			if((i==0 || grid[i-1][j]=='#') && i<h-1 && grid[i+1][j]!='#'){
				vector<char*> f;
				for(int k=i;k<h && grid[k][j]!='#';k++)
					f.push_back(&grid[k][j]);
				fs.push_back(f);
			}
			if((j==0 || grid[i][j-1]=='#') && j<w-1 && grid[i][j+1]!='#'){
				vector<char*> f;
				for(int k=j;k<w && grid[i][k]!='#';k++)
					f.push_back(&grid[i][k]);
				fs.push_back(f);
			}
		}
		
		if(any_of(all(fs),[&](const vector<char*>& f)->bool{
				string s; for(char* p:f) s+=*p;
				return s.find('.')==-1 && !check(f);
			})){
			cout<<"No!"<<endl;
			continue;
		}
		
		vvi ds(n);
		{
			vi vis(fs.size());
			rep(i,n){
				grid[is[i]][js[i]]='?';
				rep(j,fs.size()) if(!vis[j]){
					string s; for(char* p:fs[j]) s+=*p;
					if(s.find('.')==-1)
						ds[i].push_back(j),vis[j]=1;
				}
			}
			rep(i,n) grid[is[i]][js[i]]='.';
		}
		
		cout<<(solve(0,grid,cs,is,js,fs,ds)?"Yes":"No")<<endl;
	}
}

Measured memory_bytes: 1240