#include <algorithm>
#include <array>
#include <cctype>
#include <cstdlib>
#include <iostream>
#include <utility>
#include <vector>
#include <unordered_set>
using namespace std;

constexpr int MAX_SIZE = 10;
constexpr int MAX_N = 10;

int h, w;
array<string, MAX_SIZE> puzzle;

int n;
array<char, MAX_N> in;

array<bool, MAX_N> used;
array<char, 128> letters;
array<bool, 128> is_operator;
array<bool, MAX_N> not_operator;
array<bool, MAX_N> not_zero;
array<unordered_set<int>, MAX_N> left_idx, right_idx;

int number(string::const_iterator &it) {
	int res = 0;
	while(isdigit(*it)) {
		res = res * 10 + (*it - '0');
		++it;
	}
	return res;
}

int factor(string::const_iterator &it) {
	if(isdigit(*it)) return number(it);
	throw "parse error";
}

int term(string::const_iterator &it) {
	int res = factor(it);
	while(true) {
		switch(*it) {
		case '*':
		{
			++it;
			res *= factor(it);
			break;
		}
		case '/':
		{
			++it;
			const int tmp = factor(it);
			if(tmp == 0) throw "division by zero";
			if(res % tmp) throw "division leaving a remainder";
			res /= tmp;
			break;
		}
		default:
			return res;
		}
	}
	return res;
}

int expr(string::const_iterator &it) {
	int res = term(it);

	while(true) {
		switch(*it) {
		case '+':
		{
			++it;
			res += term(it);
			break;
		}
		case '-':
		{
			++it;
			res -= term(it);
			break;
		}
		default:
			return res;
		}
	}
}

bool valid(const vector<int> &expression) {
	const int n = expression.size();
	string left = "", right = "";
	int i;

	for(i = 0; i < n; ++i) {
		if(expression[i] == '=') break;
		left += letters[expression[i]];
	}

	for(++i; i < n; ++i) {
		right += letters[expression[i]];
	}

	try {
		string::const_iterator l_it = left.cbegin(), r_it = right.cbegin();
		if(expr(l_it) != expr(r_it)) return false;
	}
	catch(const char *c) {
		return false;
	}
	return true;
}

void calc(int &x, int &y, int dx, int dy) {
	while(true) {
		const int nx = x + dx;
		const int ny = y + dy;
		if(0 <= nx && nx < w && 0 <= ny && ny < h && puzzle[ny][nx] != '#') {
			x = nx;
			y = ny;
		}
		else {
			return;
		}
	}
}

void update(const vector<int> &expression) {
	for(unsigned i = 0; i < expression.size(); ++i) {
		if(isdigit(expression[i])) {
			if(i && expression[i - 1] < MAX_SIZE) {
				not_zero[expression[i - 1]] = true;
			}
		}
		else if(expression[i] < MAX_SIZE) { // space
			if(i) {
				if(expression[i - 1] < MAX_SIZE) {
					left_idx[expression[i]].insert(expression[i - 1]);
					right_idx[expression[i - 1]].insert(expression[i]);
				}
				if(i + 1 == expression.size()) {
					not_operator[expression[i]] = true;
				}
			}
			else {
				not_operator[expression[i]] = true;
			}
		}
		else { // operator
			if(expression[i - 1] < MAX_SIZE) {
				not_operator[expression[i - 1]] = true;
			}
			if(i + 1 < expression.size() && expression[i + 1] < MAX_SIZE) {
				not_operator[expression[i + 1]] = true;
			}
		}
	}
}

vector<pair<int, vector<int>>> construct() {
	vector<vector<int>> idx(h, vector<int>(w, -1));
	int next = 0;

	vector<pair<int, vector<int>>> expressions;
	expressions.reserve(40);
	for(int i = 0; i < h; ++i) {
		for(int j = 0; j < w; ++j) {
			if(puzzle[i][j] == '=') {
				// vertical
				int s = i, g = i;
				calc(j, s, 0, -1);
				calc(j, g, 0, 1);

				if(s != i && g != i) {
					vector<int> expression;
					expression.reserve(g - s + 1);
					int max_index = -1;
					for(int k = s; k <= g; ++k) {
						if(puzzle[k][j] == '.') {
							if(idx[k][j] == -1) idx[k][j] = next++;
							expression.emplace_back(idx[k][j]);
							max_index = max(max_index, idx[k][j]);
						}
						else {
							expression.emplace_back(puzzle[k][j]);
						}
					}

					update(expression);
					expressions.emplace_back(max_index, expression);
				}

				// horizontal
				s = j, g = j;
				calc(s, i, -1, 0);
				calc(g, i, 1, 0);

				if(s != j && g != j) {
					vector<int> expression;
					expression.reserve(g - s + 1);
					int max_index = -1;
					for(int k = s; k <= g; ++k) {
						if(puzzle[i][k] == '.') {
							if(idx[i][k] == -1) idx[i][k] = next++;
							expression.emplace_back(idx[i][k]);
							max_index = max(max_index, idx[i][k]);
						}
						else {
							expression.emplace_back(puzzle[i][k]);
						}
					}

					update(expression);
					expressions.emplace_back(max_index, expression);
				}
			}
		}
	}

	sort(expressions.begin(), expressions.end());
	return expressions;
}

bool dfs(const vector<pair<int, vector<int>>> &expressions, int next, int idx) {
	while(next < expressions.size() && expressions[next].first < idx) {
		if(!valid(expressions[next].second)) return false;
		++next;
	}
	if(next == expressions.size()) return true;

	for(int i = 0; i < n; ++i) {
		if(used[i]) continue;
		if(is_operator[in[i]] && not_operator[idx]) continue;
		if(in[i] == '0' && not_zero[idx]) continue;
		if(i && !used[i - 1] && in[i] == in[i - 1]) continue;

		letters[idx] = in[i];
		const auto t_no = not_operator;
		const auto t_nz = not_zero;

		if(is_operator[in[i]]) {
			for(const auto &e : left_idx[idx]) not_operator[e] = true;
			for(const auto &e : right_idx[idx]) not_operator[e] = true;
		}
		else {
			for(const auto &e : left_idx[idx]) not_zero[e];
		}

		used[i] = true;
		if(dfs(expressions, next, idx + 1)) return true;
		used[i] = false;

		not_operator = t_no;
		not_zero = t_nz;
	}

	return false;
}

int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	is_operator.fill(false);
	is_operator['+'] = true;
	is_operator['-'] = true;
	is_operator['*'] = true;
	is_operator['/'] = true;
	iota(begin(letters), end(letters), 0);

	while(cin >> h >> w && h) {
		used.fill(false);
		not_operator.fill(false);
		not_zero.fill(false);
		for(int i = 0; i < n; ++i) {
			left_idx[i].clear();
			right_idx[i].clear();
		}

		for(int i = 0; i < h; ++i) {
			cin >> puzzle[i];
		}

		cin >> n;
		for(int i = 0; i < n; ++i) {
			cin >> in[i];
		}
		sort(in.begin(), in.begin() + n);

		const auto expressions = construct();
		cout << (dfs(expressions, 0, 0) ? "Yes\n" : "No\n");
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1304