#include <bits/stdc++.h>
using namespace std;
vector<char> ans;
int n, m, len[100010];
char a[1010][1010];
char dis[100010];
int b[1010][1010];
int main() {
  scanf("%d%d", &n, &m);
  for (register int i = 1; i <= n; i++) scanf("%s", a[i] + 1);
  for (register int i = 1; i <= n; i++) {
    for (register int j = 1; j <= m; j++) {
      b[i][j] = b[i - 1][j] + b[i][j - 1] - b[i - 1][j - 1] +
                (a[i][j] == '#' ? 1 : 0);
    }
  }
  int p;
  scanf("%d", &p);
  for (register int i = 1; i <= p; i++) {
    cin >> dis[i] >> len[i];
  }
  for (register int i = 1; i <= n; i++) {
    for (register int j = 1; j <= m; j++) {
      if (a[i][j] >= 'A' && a[i][j] <= 'Z') {
        bool ck = true;
        int x = i, y = j;
        for (register int k = 1; k <= p; k++) {
          int xx = x, yy = y;
          if (dis[k] == 'N') x -= len[k];
          if (dis[k] == 'S') x += len[k];
          if (dis[k] == 'W') y -= len[k];
          if (dis[k] == 'E') y += len[k];
          if (x < 1 || x > n || y < 1 || y > m ||
              (b[max(x, xx)][max(y, yy)] - b[min(x, xx) - 1][max(y, yy)] -
               b[max(x, xx)][min(y, yy) - 1] +
               b[min(xx, x) - 1][min(y, yy) - 1])) {
            ck = false;
            break;
          }
        }
        if (ck) ans.push_back(a[i][j]);
      }
    }
  }
  if (ans.size() == 0) {
    printf("no solution\n");
    return 0;
  }
  sort(ans.begin(), ans.end());
  for (register int i = 0; i < ans.size(); i++) putchar(ans[i]);
  putchar(10);
}
