#include <bits/stdc++.h>
using namespace std;
int R, C, K, cum[1100][1100], num;
char g[1100][1100];
pair<int, int> in[100100];
string s;
int q(int r, int c, int rr, int cc) {
  int bx = max(r, rr), by = max(c, cc);
  int sx = min(r, rr), sy = min(c, cc);
  return cum[bx][by] - (sx ? cum[sx - 1][by] : 0) - (sy ? cum[bx][sy - 1] : 0) +
         (sx && sy ? cum[sx - 1][sy - 1] : 0);
}
int dr[] = {-1, 1, 0, 0};
int dc[] = {0, 0, -1, 1};
int main() {
  scanf("%d %d", &R, &C);
  for (int i = (0); i < (R); i++) scanf(" %s", g[i]);
  for (int i = (0); i < (R); i++)
    for (int j = (0); j < (C); j++)
      cum[i][j] = (i ? cum[i - 1][j] : 0) + (j ? cum[i][j - 1] : 0) -
                  (i && j ? cum[i - 1][j - 1] : 0) + (g[i][j] == '#');
  scanf("%d", &K);
  for (int i = (0); i < (K); i++) {
    int a, b;
    char c;
    scanf(" %c %d", &c, &b);
    if (c == 'N') a = 0;
    if (c == 'S') a = 1;
    if (c == 'W') a = 2;
    if (c == 'E') a = 3;
    in[i] = make_pair(a, b);
  }
  for (int i = (0); i < (R); i++)
    for (int j = (0); j < (C); j++)
      if ('A' <= g[i][j] && g[i][j] <= 'Z') {
        int r = i, c = j, nr, nc;
        bool ok = 1;
        for (int k = (0); k < (K); k++) {
          nr = r + in[k].second * dr[in[k].first];
          nc = c + in[k].second * dc[in[k].first];
          if (nr < 0 || nc < 0 || nr >= R || nc >= C) {
            ok = 0;
            break;
          }
          if (q(r, c, nr, nc)) {
            ok = 0;
            break;
          }
          r = nr, c = nc;
        }
        if (ok) s += g[i][j];
      }
  sort(s.begin(), s.end());
  if (s.size())
    printf("%s\n", s.c_str());
  else
    puts("no solution");
  return 0;
}
