#include <bits/stdc++.h>
using namespace std;
int k;
char a[1003][1002], st[100004];
int ml[100004];
int pre[1002][1002], m, n;
vector<char> ans;
int sum(int sx, int sy, int dx, int dy) {
  return (pre[dx][dy] - pre[sx - 1][dy] - pre[dx][sy - 1] +
          pre[sx - 1][sy - 1]);
}
int dfs(int x, int y) {
  int i, dx, dy;
  for (i = 1; i <= k; i++) {
    dx = x;
    dy = y;
    if (st[i] == 'N')
      dx = x - ml[i];
    else if (st[i] == 'S')
      dx = x + ml[i];
    else if (st[i] == 'E')
      dy = y + ml[i];
    else
      dy -= ml[i];
    if (dx < 1 || dy < 1 || dx > m || dy > n) return 0;
    if (sum(min(x, dx), min(y, dy), max(dx, x), max(y, dy)) > 0) return 0;
    x = dx;
    y = dy;
  }
  return 1;
}
int main() {
  int i, j;
  scanf("%d %d", &m, &n);
  for (i = 1; i <= m; i++) {
    for (j = 1; j <= n; j++) {
      scanf(" %c", &a[i][j]);
      pre[i][j] =
          pre[i - 1][j] + pre[i][j - 1] - pre[i - 1][j - 1] + (a[i][j] == '#');
    }
  }
  scanf("%d", &k);
  for (i = 1; i <= k; i++) {
    scanf(" %c %d", &st[i], &ml[i]);
  }
  for (i = 1; i <= m; i++) {
    for (j = 1; j <= n; j++) {
      if (a[i][j] >= 'A' && a[i][j] <= 'Z')
        if (dfs(i, j)) ans.push_back(a[i][j]);
    }
  }
  sort(ans.begin(), ans.end());
  if (ans.size() == 0) printf("no solution");
  for (i = 0; i < ans.size(); i++) {
    printf("%c", ans[i]);
  }
  printf("\n");
  return 0;
}
