#include <bits/stdc++.h>
using namespace std;
const int NMAX = 1005;
const int QMAX = 1e5 + 5;
char s[NMAX][NMAX], dir[QMAX];
int v[4][NMAX][NMAX], len[QMAX];
int top, N, M, Q;
char st[105];
map<char, int> mp;
inline bool iswithinbounds(int x, int y) {
  return x > 0 && y > 0 && x <= N && y <= M;
}
inline bool BFS(int x, int y) {
  int i, j;
  bool ok = 1;
  for (i = 1; ok && i <= Q; ++i) {
    int ind = mp[dir[i]];
    int maxim = v[ind][x][y];
    int newx = x, newy = y;
    if (ind == 0)
      newx -= len[i];
    else if (ind == 1)
      newx += len[i];
    else if (ind == 2)
      newy -= len[i];
    else
      newy += len[i];
    if (iswithinbounds(newx, newy) && len[i] <= maxim - 1)
      x = newx, y = newy;
    else
      ok = 0;
  }
  return ok;
}
int main() {
  int i, j;
  cin >> N >> M;
  for (i = 1; i <= N; ++i) cin >> (s[i] + 1);
  for (j = 1; j <= M; ++j) {
    for (i = 1; i <= N; ++i) {
      if (s[i][j] == '#')
        v[0][i][j] = 0;
      else
        v[0][i][j] = v[0][i - 1][j] + 1;
    }
  }
  for (j = 1; j <= M; ++j) {
    for (i = N; i; --i) {
      if (s[i][j] == '#')
        v[1][i][j] = 0;
      else
        v[1][i][j] = v[1][i + 1][j] + 1;
    }
  }
  for (j = 1; j <= M; ++j) {
    for (i = 1; i <= N; ++i) {
      if (s[i][j] == '#')
        v[2][i][j] = 0;
      else
        v[2][i][j] = v[2][i][j - 1] + 1;
    }
  }
  for (j = M; j; --j) {
    for (i = 1; i <= N; ++i) {
      if (s[i][j] == '#')
        v[3][i][j] = 0;
      else
        v[3][i][j] = v[3][i][j + 1] + 1;
    }
  }
  mp['N'] = 0;
  mp['S'] = 1;
  mp['W'] = 2;
  mp['E'] = 3;
  cin >> Q;
  for (i = 1; i <= Q; ++i) cin >> dir[i] >> len[i];
  for (i = 1; i <= N; ++i)
    for (j = 1; j <= M; ++j)
      if ('A' <= s[i][j] && s[i][j] <= 'Z') {
        if (BFS(i, j)) st[++top] = s[i][j];
      }
  sort(st + 1, st + top + 1);
  for (i = 1; i <= top; ++i) cout << st[i];
  if (top == 0) cout << "no solution";
  return 0;
}
