#include <bits/stdc++.h>
using namespace std;
int n, m, q, ll[1010][1010], uu[1010][1010], rr[1010][1010], dd[1010][1010],
    cc[1010][1010], len[100010], ans[30], vt;
char s[1010][1010], ch[100010];
bool check(int x, int y) {
  for (int i = 1; i <= q; ++i) {
    if (ch[i] == 'N') {
      if (uu[x][y] < len[i]) return 0;
      x -= len[i];
    }
    if (ch[i] == 'S') {
      if (dd[x][y] < len[i]) return 0;
      x += len[i];
    }
    if (ch[i] == 'E') {
      if (rr[x][y] < len[i]) return 0;
      y += len[i];
    }
    if (ch[i] == 'W') {
      if (ll[x][y] < len[i]) return 0;
      y -= len[i];
    }
  }
  return 1;
}
int main() {
  scanf("%d%d", &n, &m);
  queue<pair<int, int> > qu;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      cin >> s[i][j];
      if (s[i][j] == '#') {
        cc[i][j] = 1;
        continue;
      }
      if (s[i][j] <= 'Z' && s[i][j] >= 'A') {
        qu.push(make_pair(i, j));
      }
    }
  }
  memset(ll, -1, sizeof(ll));
  memset(rr, -1, sizeof(rr));
  memset(uu, -1, sizeof(uu));
  memset(dd, -1, sizeof(dd));
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      if (!cc[i][j]) {
        ll[i][j] = ll[i][j - 1] + 1;
        uu[i][j] = uu[i - 1][j] + 1;
      }
  for (int i = n; i >= 1; --i)
    for (int j = m; j >= 1; --j)
      if (!cc[i][j]) {
        rr[i][j] = rr[i][j + 1] + 1;
        dd[i][j] = dd[i + 1][j] + 1;
      }
  scanf("%d", &q);
  for (int i = 1; i <= q; ++i) {
    cin >> ch[i] >> len[i];
  }
  int flag = 0;
  while (!qu.empty()) {
    pair<int, int> k;
    k = qu.front();
    qu.pop();
    if (check(k.first, k.second)) {
      ans[++vt] = s[k.first][k.second];
      flag = 1;
    }
  }
  if (flag == 0)
    printf("no solution\n");
  else {
    sort(ans + 1, ans + vt + 1);
    for (int i = 1; i <= vt; ++i) printf("%c", ans[i]);
    printf("\n");
  }
  return 0;
}
