#include <bits/stdc++.h>
using namespace std;
struct {
  char dir;
  int len;
} act[100005];
char gra[1005][1005];
int map1[1005][1005], map2[1005][1005];
char str[100005];
int cmp(char a, char b) { return a < b; }
int main() {
  int n, m, l, i, j, k, t, line, lie, flag, count;
  while (~scanf("%d %d", &n, &m)) {
    getchar();
    for (i = 1; i <= n; i++) scanf("%s", gra[i] + 1);
    scanf("%d", &l);
    for (i = 1; i <= l; i++) {
      getchar();
      scanf("%c %d", &act[i].dir, &act[i].len);
    }
    for (i = 1; i <= n; i++) {
      count = 0;
      for (j = 1; j <= m; j++) {
        if (gra[i][j] == '#') count++;
        map1[i][j] = count;
      }
    }
    for (j = 1; j <= m; j++) {
      count = 0;
      for (i = 1; i <= n; i++) {
        if (gra[i][j] == '#') count++;
        map2[i][j] = count;
      }
    }
    count = 0;
    for (i = 1; i <= n; i++) {
      for (j = 1; j <= m; j++) {
        if (isalpha(gra[i][j])) {
          line = i;
          lie = j;
          flag = 0;
          for (k = 1; k <= l; k++) {
            switch (act[k].dir) {
              case 'N':
                if (line - act[k].len < 1 ||
                    gra[line - act[k].len][lie] == '#' ||
                    map2[line][lie] != map2[line - act[k].len][lie])
                  flag = 1;
                else
                  line -= act[k].len;
                break;
              case 'S':
                if (line + act[k].len > n ||
                    gra[line + act[k].len][lie] == '#' ||
                    map2[line][lie] != map2[line + act[k].len][lie])
                  flag = 1;
                else
                  line += act[k].len;
                break;
              case 'W':
                if (lie - act[k].len < 1 ||
                    gra[line][lie - act[k].len] == '#' ||
                    map1[line][lie] != map1[line][lie - act[k].len])
                  flag = 1;
                else
                  lie -= act[k].len;
                break;
              case 'E':
                if (lie + act[k].len > m ||
                    gra[line][lie + act[k].len] == '#' ||
                    map1[line][lie] != map1[line][lie + act[k].len])
                  flag = 1;
                else
                  lie += act[k].len;
                break;
            }
            if (flag) break;
          }
          if (!flag) str[count++] = gra[i][j];
        }
      }
    }
    if (!count)
      printf("no solution\n");
    else {
      str[count] = '\0';
      sort(str, str + count);
      printf("%s\n", str);
    }
  }
  return 0;
}
