#include <bits/stdc++.h>
using namespace std;
int m, n, i, tren[1000][1000], duoi[1000][1000], phai[1000][1000],
    trai[1000][1000], j, k, sl[100001], x, y, l, ts;
bool p;
char ch[100001], res[100];
string a[1001];
int main() {
  cin >> m >> n;
  for (i = 0; i < m; i++) cin >> a[i];
  memset(tren, 0, sizeof(tren));
  memset(duoi, 0, sizeof(duoi));
  memset(trai, 0, sizeof(trai));
  memset(phai, 0, sizeof(phai));
  for (i = 0; i < m; i++)
    for (j = 0; j < n; j++) {
      if (i == 0 || a[i - 1][j] == '#')
        tren[i][j] = 0;
      else
        tren[i][j] = tren[i - 1][j] + 1;
      if (j == 0 || a[i][j - 1] == '#')
        trai[i][j] = 0;
      else
        trai[i][j] = trai[i][j - 1] + 1;
    }
  for (i = m - 1; i >= 0; i--)
    for (j = n - 1; j >= 0; j--) {
      if (i == m - 1 || a[i + 1][j] == '#')
        duoi[i][j] = 0;
      else
        duoi[i][j] = duoi[i + 1][j] + 1;
      if (j == n - 1 || a[i][j + 1] == '#')
        phai[i][j] = 0;
      else
        phai[i][j] = phai[i][j + 1] + 1;
    }
  cin >> k;
  for (i = 1; i <= k; i++) cin >> ch[i] >> sl[i];
  ts = 0;
  for (i = 0; i < m; i++)
    for (j = 0; j < n; j++)
      if (a[i][j] != '.' && a[i][j] != '#') {
        p = true;
        x = i;
        y = j;
        for (l = 1; l <= k; l++)
          if (ch[l] == 'N') {
            if (tren[x][y] >= sl[l])
              x -= sl[l];
            else {
              p = false;
              break;
            }
          } else if (ch[l] == 'W') {
            if (trai[x][y] >= sl[l])
              y -= sl[l];
            else {
              p = false;
              break;
            }
          } else if (ch[l] == 'E') {
            if (phai[x][y] >= sl[l])
              y += sl[l];
            else {
              p = false;
              break;
            }
          } else {
            if (duoi[x][y] >= sl[l])
              x += sl[l];
            else {
              p = false;
              break;
            }
          }
        if (p == true) {
          ts++;
          res[ts] = a[i][j];
        }
      }
  sort(res + 1, res + ts + 1);
  if (ts == 0)
    cout << "no solution";
  else
    for (i = 1; i <= ts; i++) cout << res[i];
}
