#include <bits/stdc++.h>
using namespace std;
int n, m, q;
char a[1001][1001];
int dis[1001][1001][4];
struct node {
  int dir;
  int len;
} b[100001];
void dfs() {
  int i, j, k, r;
  for (i = 1; i < n - 1; i++) {
    j = 1;
    while (j < m - 1) {
      while (j < m - 1 && a[i][j] == '#') j++;
      r = j;
      k = j;
      while (j < m - 1 && a[i][j] != '#') j++;
      for (; r < j; r++) {
        dis[i][r][0] = r - k;
        dis[i][r][1] = j - r - 1;
      }
    }
  }
  for (j = 1; j < m - 1; j++) {
    i = 1;
    while (i < n - 1) {
      while (i < n - 1 && a[i][j] == '#') i++;
      r = i;
      k = i;
      while (i < n - 1 && a[i][j] != '#') i++;
      for (; r < i; r++) {
        dis[r][j][2] = r - k;
        dis[r][j][3] = i - r - 1;
      }
    }
  }
}
int d[4][2] = {{0, -1}, {0, 1}, {-1, 0}, {1, 0}};
int check(int i, int j) {
  int r = 0, len, dir;
  while (r < q) {
    dir = b[r].dir;
    len = b[r].len;
    if (dis[i][j][dir] < len) return 0;
    i = i + len * d[dir][0];
    j = j + len * d[dir][1];
    r++;
  }
  return 1;
}
int ans[30];
int main() {
  int i, j, k;
  char ch;
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; i++) scanf("%s", a[i]);
  scanf("%d", &q);
  for (i = 0; i < q; i++) {
    getchar();
    scanf("%c%d", &ch, &b[i].len);
    if (ch == 'W')
      b[i].dir = 0;
    else if (ch == 'E')
      b[i].dir = 1;
    else if (ch == 'N')
      b[i].dir = 2;
    else
      b[i].dir = 3;
  }
  dfs();
  k = 0;
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++)
      if (a[i][j] >= 'A' && a[i][j] <= 'Z')
        if (check(i, j)) {
          ans[k++] = a[i][j];
        }
  if (k > 0) {
    sort(ans, ans + k);
    printf("%c", ans[0]);
    for (i = 1; i < k; i++) printf("%c", ans[i]);
    printf("\n");
  } else
    printf("no solution\n");
  return 0;
}
