#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y, f;
  char na;
} f[30];
bool cmp(node a, node b) { return a.na < b.na; }
char s[1005][1005];
int s1[1005][1005];
int s2[1005][1005];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
  memset(f, 0, sizeof(f));
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      s1[i][j] = s1[i][j - 1] + ((s[i][j] == '#') ? 1 : 0);
    }
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++) {
      s2[j][i] = s2[j - 1][i] + ((s[j][i] == '#') ? 1 : 0);
    }
  int ns = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      if (s[i][j] >= 'A' && s[i][j] <= 'Z') {
        f[ns].x = i;
        f[ns].y = j;
        f[ns].na = s[i][j];
        ns++;
      }
    }
  sort(f, f + ns, cmp);
  int nq;
  scanf("%d", &nq);
  for (int i = 0; i < nq; i++) {
    char dir[9];
    int len;
    scanf("%s %d", dir, &len);
    for (int j = 0; j < ns; j++) {
      if (!f[j].f) {
        if (dir[0] == 'W') {
          if (f[j].y - len < 1)
            f[j].f = 1;
          else if (s1[f[j].x][f[j].y] - s1[f[j].x][f[j].y - len - 1] > 0)
            f[j].f = 1;
          f[j].y = f[j].y - len;
        }
        if (dir[0] == 'E') {
          if (f[j].y + len > m)
            f[j].f = 1;
          else if (s1[f[j].x][f[j].y + len] - s1[f[j].x][f[j].y - 1] > 0)
            f[j].f = 1;
          f[j].y = f[j].y + len;
        }
        if (dir[0] == 'S') {
          if (f[j].x + len > n)
            f[j].f = 1;
          else if (s2[f[j].x + len][f[j].y] - s2[f[j].x - 1][f[j].y] > 0)
            f[j].f = 1;
          f[j].x = f[j].x + len;
        }
        if (dir[0] == 'N') {
          if (f[j].x - len < 1)
            f[j].f = 1;
          else if (s2[f[j].x][f[j].y] - s2[f[j].x - len - 1][f[j].y] > 0)
            f[j].f = 1;
          f[j].x = f[j].x - len;
        }
      }
    }
  }
  int flag = 0;
  for (int i = 0; i < ns; i++) {
    if (!f[i].f) {
      printf("%c", f[i].na);
      flag = 1;
    }
  }
  if (!flag) printf("no solution");
  puts("");
}
