#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a > b) swap(a, b);
  if (a == 0) return b;
  return gcd(b % a, a);
}
int log2(int x, int max) { return max - __builtin_clz(x) - 1; }
long long powerMod(long long x, long long y) {
  long long res = 1;
  x %= 1000000007;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int n, m, i, j, k, l, x, y, c;
  vector<pair<int, int> > v, dir;
  cin >> n >> m;
  string s[n];
  int row[n][m];
  int col[n][m];
  memset((row), 0, sizeof((row)));
  memset((col), 0, sizeof((col)));
  for (i = 0; i < n; i++) {
    row[i][0] = 1;
  }
  for (i = 0; i < m; i++) {
    col[0][i] = 1;
  }
  for (i = 0; i < n; i++) {
    cin >> s[i];
    for (j = 0; j < m; j++) {
      if (s[i][j] >= 'A' && s[i][j] <= 'Z') v.push_back(make_pair(i, j));
      if (j > 0) {
        if (s[i][j] == '#')
          row[i][j] = row[i][j - 1] + 1;
        else
          row[i][j] = row[i][j - 1];
      }
      if (i > 0) {
        if (s[i][j] == '#')
          col[i][j] = col[i - 1][j] + 1;
        else
          col[i][j] = col[i - 1][j];
      }
    }
  }
  cin >> k;
  string st;
  for (i = 0; i < k; i++) {
    cin >> st >> l;
    if (st[0] == 'N') dir.push_back(make_pair(0, l));
    if (st[0] == 'S') dir.push_back(make_pair(1, l));
    if (st[0] == 'E') dir.push_back(make_pair(2, l));
    if (st[0] == 'W') dir.push_back(make_pair(3, l));
  }
  st = "";
  for (l = 0; l < v.size(); l++) {
    x = v[l].first, y = v[l].second;
    for (i = 0; i < k; i++) {
      j = dir[i].first;
      c = dir[i].second;
      if (j == 0) {
        if (x < c) goto loop;
        if (col[x][y] - col[x - c][y] == 0 && s[x - c][y] != '#')
          x -= c;
        else
          goto loop;
      }
      if (j == 1) {
        if (x + c >= n) goto loop;
        if (col[x + c][y] - col[x][y] == 0)
          x += c;
        else
          goto loop;
      }
      if (j == 2) {
        if (y + c >= m) goto loop;
        if (row[x][y + c] - row[x][y] == 0)
          y += c;
        else
          goto loop;
      }
      if (j == 3) {
        if (y < c) goto loop;
        if (row[x][y] - row[x][y - c] == 0 && s[x][y - c] != '#')
          y -= c;
        else
          goto loop;
      }
    }
    st += s[v[l].first][v[l].second];
  loop:;
  }
  if (st == "") {
    cout << "no solution\n";
    return 0;
  }
  sort(st.begin(), st.end());
  cout << st << endl;
  return 0;
}
