#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const int inf = 1000 * 1000 * 1000;
const int N = 1000 + 7;
char ar[N][N];
int n, m;
vector<pair<int, int> > g;
vector<char> lol;
vector<char> res;
vector<pair<char, int> > L;
struct p {
  int n, s, w, e;
  p() { n = s = w = e = 0; }
};
p sea[N][N];
int main() {
  scanf("%d%d", &n, &m);
  char buf[N];
  for (int i = 0; i < n; i++) {
    scanf("%s", buf);
    for (int j = 0; j < m; j++) {
      char xD;
      xD = buf[j];
      ar[i][j] = xD;
      if (xD >= 'A' && xD <= 'Z') {
        pair<int, int> f;
        f.first = i;
        f.second = j;
        g.push_back(f);
        lol.push_back(xD);
      }
    }
  }
  for (int j = 0; j < m; j++) {
    for (int i = 1; i < n; i++) {
      if (ar[i][j] != '#') {
        if (ar[i - 1][j] == '#')
          sea[i][j].n = 1;
        else
          sea[i][j].n = sea[i - 1][j].n + 1;
      }
    }
    for (int i = n - 1; i >= 0; i--) {
      if (ar[i][j] != '#') {
        if (ar[i + 1][j] == '#')
          sea[i][j].s = 1;
        else
          sea[i][j].s = sea[i + 1][j].s + 1;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 1; j < m; j++) {
      if (ar[i][j] != '#') {
        if (ar[i][j - 1] == '#')
          sea[i][j].w = 1;
        else
          sea[i][j].w = sea[i][j - 1].w + 1;
      }
    }
    for (int j = m - 1; j >= 0; j--) {
      if (ar[i][j] != '#') {
        if (ar[i][j + 1] == '#')
          sea[i][j].e = 1;
        else
          sea[i][j].e = sea[i][j + 1].e + 1;
      }
    }
  }
  int k;
  scanf("%d", &k);
  for (int i = 0; i < k; i++) {
    char dir;
    int len;
    cin >> dir;
    scanf("%d", &len);
    pair<char, int> f;
    f.first = dir;
    f.second = len;
    L.push_back(f);
  }
  for (int q = 0; q < (int)g.size(); q++) {
    int i = g[q].first;
    int j = g[q].second;
    bool ok = 1;
    for (int d = 0; d < k; d++) {
      if (L[d].first == 'N') {
        if (i - L[d].second < 0 || sea[i][j].n <= L[d].second ||
            ar[i - L[d].second][j] == '#') {
          ok = 0;
          break;
        } else {
          i -= L[d].second;
        }
      }
      if (L[d].first == 'S') {
        if (i + L[d].second >= n || sea[i][j].s <= L[d].second ||
            ar[i + L[d].second][j] == '#') {
          ok = 0;
          break;
        } else {
          i += L[d].second;
        }
      }
      if (L[d].first == 'W') {
        if (j - L[d].second < 0 || sea[i][j].w <= L[d].second ||
            ar[i][j - L[d].second] == '#') {
          ok = 0;
          break;
        } else {
          j -= L[d].second;
        }
      }
      if (L[d].first == 'E') {
        if (j + L[d].second >= m || sea[i][j].e <= L[d].second ||
            ar[i][j + L[d].second] == '#') {
          ok = 0;
          break;
        } else {
          j += L[d].second;
        }
      }
    }
    if (ok) res.push_back(lol[q]);
  }
  if ((int)res.size() == 0)
    printf("no solution");
  else {
    sort(res.begin(), res.end());
    for (int i = 0; i < (int)res.size(); i++) printf("%c", res[i]);
  }
  return 0;
}
