#include <bits/stdc++.h>
using namespace std;
int n, m, k, tot = 0, ok[30];
int xx[1005][1005], yy[1005][1005];
char g[1005][1005];
struct step {
  char w;
  int p;
} st[100005];
bool cant(int x, int y) {
  return g[x][y] == '#' || x <= 0 || y <= 0 || x > n || y > m;
}
bool check(int x, int y) {
  if (g[x][y] < 'A' || g[x][y] > 'Z') return 0;
  int nx = x, ny = y;
  for (int i = 1; i <= k; i++) {
    if (st[i].w == 'N') {
      if (cant(nx - st[i].p, ny)) return 0;
      if (yy[nx][ny] != yy[nx - st[i].p][ny]) return 0;
      nx -= st[i].p;
    }
    if (st[i].w == 'S') {
      if (cant(nx + st[i].p, ny)) return 0;
      if (yy[nx][ny] != yy[nx + st[i].p][ny]) return 0;
      nx += st[i].p;
    }
    if (st[i].w == 'E') {
      if (cant(nx, ny + st[i].p)) return 0;
      if (xx[nx][ny] != xx[nx][ny + st[i].p]) return 0;
      ny += st[i].p;
    }
    if (st[i].w == 'W') {
      if (cant(nx, ny - st[i].p)) return 0;
      if (xx[nx][ny] != xx[nx][ny - st[i].p]) return 0;
      ny -= st[i].p;
    }
  }
  return 1;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", g[i] + 1);
  scanf("%d", &k);
  for (int i = 1; i <= k; i++) scanf("%s%d", &st[i].w, &st[i].p);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (g[i][j] == '#') {
        xx[i][j] = xx[i][j - 1] + 1;
        yy[i][j] = yy[i - 1][j] + 1;
      } else {
        xx[i][j] = xx[i][j - 1];
        yy[i][j] = yy[i - 1][j];
      }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (check(i, j)) tot++, ok[g[i][j] - 'A'] = 1;
  if (!tot)
    printf("no solution");
  else
    for (int i = 0; i < 26; i++)
      if (ok[i]) printf("%c", i + 'A');
  return 0;
}
