#include <bits/stdc++.h>
using namespace std;
pair<char, int> a[100007];
string s[1007];
pair<int, int> pos[30];
int q;
int n, m;
int sum[1007][1007];
string ans;
bool isvalid(int x, int y, int xx, int yy) {
  if (xx >= n || xx < 0 || yy >= m || yy < 0) return false;
  if (x == xx) {
    if (y > yy) swap(y, yy);
    return ((sum[xx + 1][yy + 1] + sum[x][y] - sum[xx + 1][y] -
             sum[x][yy + 1]) == 0);
  } else if (y == yy) {
    if (x > xx) swap(x, xx);
    return ((sum[xx + 1][yy + 1] + sum[x][y] - sum[xx + 1][y] -
             sum[x][yy + 1]) == 0);
  }
}
bool func(int x, int y, int z) {
  if (z >= q) return true;
  if (a[z].first == 'W') {
    int yy = y - a[z].second;
    if (isvalid(x, y, x, yy)) return func(x, yy, z + 1);
  } else if (a[z].first == 'E') {
    int yy = y + a[z].second;
    if (isvalid(x, y, x, yy)) return func(x, yy, z + 1);
  } else if (a[z].first == 'S') {
    int xx = x + a[z].second;
    if (isvalid(x, y, xx, y)) return func(xx, y, z + 1);
  } else {
    int xx = x - a[z].second;
    if (isvalid(x, y, xx, y)) return func(xx, y, z + 1);
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    for (int j = 0; j < s[i].size(); j++) {
      if (s[i][j] >= 'A' && s[i][j] <= 'Z')
        pos[s[i][j] - 'A'] = make_pair(i, j);
      sum[i + 1][j + 1] =
          sum[i][j + 1] + sum[i + 1][j] - sum[i][j] + (s[i][j] == '#');
    }
  }
  cin >> q;
  for (int i = 0; i < q; i++) cin >> a[i].first >> a[i].second;
  for (int i = 0; i < 26; i++)
    if (func(pos[i].first, pos[i].second, 0)) ans += (char)('A' + i);
  if (ans.size() == 0)
    cout << "no solution" << endl;
  else
    cout << ans << endl;
  return 0;
}
