#include <bits/stdc++.h>
using namespace std;
const int N = 1100;
char maze[N][N];
char ans[N * N];
int len = 0;
int d[30];
char dira[N * N];
int dirl[N * N];
int sr[N][N], sc[N][N];
int dir[4][2] = {{-1, 0}, {1, 0}, {0, 1}, {0, -1}};
void initDir() {
  d['N'] = 0;
  d['S'] = 1;
  d['E'] = 2;
  d['W'] = 3;
}
bool walk(int &x, int &y, int dx, int dl, int n, int m) {
  int x1, y1;
  x1 = x + dir[dx][0] * (dl);
  y1 = y + dir[dx][1] * (dl);
  if (x1 < 0 || x1 >= n || y1 < 0 || y1 >= m) return false;
  int s = 0;
  if (dx < 2) {
    s = sc[x][y] - sc[x1][y1];
  } else {
    s = sr[x][y] - sr[x1][y1];
  }
  if (s) {
    return false;
  }
  x += dir[dx][0] * (dl);
  y += dir[dx][1] * (dl);
  if (maze[x][y] == '#') return false;
  return true;
}
int main() {
  int n, m, i, j;
  initDir();
  char ch[100];
  while (scanf("%d%d", &n, &m) != EOF) {
    for (i = 0; i < n; i++) {
      scanf("%s", maze[i]);
    }
    memset(sr, 0, sizeof(sr));
    memset(sc, 0, sizeof(sc));
    len = 0;
    int k;
    scanf("%d", &k);
    for (i = 0; i < k; i++) {
      scanf("%s", ch);
      dira[i] = ch[0];
      scanf("%d", dirl + i);
    }
    for (i = 0; i < n; i++) {
      sr[i][0] = 1;
    }
    for (i = 0; i < n; i++) {
      for (j = 1; j < m; j++) {
        sr[i][j] = sr[i][j - 1];
        if (maze[i][j] == '#') sr[i][j]++;
      }
    }
    for (i = 0; i < m; i++) {
      sc[0][i] = 1;
    }
    for (i = 1; i < n; i++) {
      for (j = 0; j < m; j++) {
        sc[i][j] = sc[i - 1][j];
        if (maze[i][j] == '#') sc[i][j]++;
      }
    }
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        if (!isalpha(maze[i][j])) continue;
        int s;
        int x, y;
        x = i, y = j;
        if (maze[i][j] == 'A') {
          s = 0;
        }
        for (s = 0; s < k; s++) {
          if (!walk(x, y, d[dira[s]], dirl[s], n, m)) break;
        }
        if (s == k) {
          ans[len++] = maze[i][j];
        }
        if (len == 26) break;
      }
      if (len == 26) break;
    }
    ans[len] = 0;
    sort(ans, ans + len);
    if (len) {
      puts(ans);
    } else {
      puts("no solution");
    }
  }
  return 0;
}
