#include <bits/stdc++.h>
using namespace std;
const long long LINF = ~(((long long)0x1) << 63) / 2;
const int INF = 0X3F3F3F3F;
const double eps = 1e-7;
char mat[1100][1100];
struct Node {
  int l, r;
} node[2100][2100];
int len[3000];
struct Dir {
  char s[10];
  int len;
} p[120000];
int find(int r, int c) {
  int left = 0, right = len[r] - 1;
  int mid, re = -1;
  while (left <= right) {
    mid = (left + right) / 2;
    if (node[r][mid].l <= c) {
      re = mid;
      left = mid + 1;
    } else
      right = mid - 1;
  }
  return re;
}
int main() {
  int r, c, i, j, k, m, x, y, b;
  cin >> r >> c;
  vector<char> ans;
  for (i = 1; i <= r; i++) cin >> mat[i] + 1;
  for (i = 1; i <= r; i++) {
    for (j = 1; j <= c; j++)
      if (mat[i][j] != '#') {
        node[i][len[i]].l = j;
        while (mat[i][j] != '#' && j <= c) j++;
        j--;
        node[i][len[i]++].r = j;
      }
  }
  for (i = 1; i <= c; i++)
    for (j = 1; j <= r; j++)
      if (mat[j][i] != '#') {
        x = i + r;
        node[x][len[x]].l = j;
        while (mat[j][i] != '#' && j <= r) j++;
        j--;
        node[x][len[x]++].r = j;
      }
  cin >> m;
  for (i = 1; i <= m; i++) cin >> p[i].s >> p[i].len;
  int now;
  int i1, j1;
  for (i1 = 1; i1 <= r; i1++)
    for (j1 = 1; j1 <= c; j1++)
      if (mat[i1][j1] >= 'A' && mat[i1][j1] <= 'Z') {
        bool flag = true;
        i = i1;
        j = j1;
        for (k = 1; k <= m; k++) {
          if (p[k].s[0] == 'N') {
            x = i - p[k].len;
            y = j;
            if (x <= 0) {
              flag = false;
              break;
            }
            now = find(r + j, i);
            b = r + j;
            if (now == -1 || !(node[b][now].l <= x && node[b][now].r >= x &&
                               node[b][now].l <= i && i <= node[b][now].r)) {
              flag = false;
              break;
            }
          } else if (p[k].s[0] == 'S') {
            x = i + p[k].len;
            y = j;
            if (x > r) {
              flag = false;
              break;
            }
            now = find(r + j, i);
            b = r + j;
            if (now == -1 || !(node[b][now].l <= x && node[b][now].r >= x &&
                               node[b][now].l <= i && i <= node[b][now].r)) {
              flag = false;
              break;
            }
          } else if (p[k].s[0] == 'E') {
            x = i;
            y = j + p[k].len;
            if (y <= 0) {
              flag = false;
              break;
            }
            now = find(i, j);
            b = i;
            if (now == -1 || !(node[b][now].l <= j && node[b][now].r >= j &&
                               node[b][now].l <= y && y <= node[b][now].r)) {
              flag = false;
              break;
            }
          } else {
            x = i;
            y = j - p[k].len;
            if (y > c) {
              flag = false;
              break;
            }
            now = find(i, j);
            b = i;
            if (now == -1 || !(node[b][now].l <= j && node[b][now].r >= j &&
                               node[b][now].l <= y && y <= node[b][now].r)) {
              flag = false;
              break;
            }
          }
          i = x;
          j = y;
        }
        if (flag) ans.push_back(mat[i1][j1]);
      }
  k = ans.size();
  sort(ans.begin(), ans.end());
  if (k == 0)
    puts("no solution");
  else {
    for (i = 0; i < k; i++) cout << ans[i];
    cout << endl;
  }
  return 0;
}
