#include <bits/stdc++.h>
using namespace std;
int k, n, m, l[100500], s[1010][1010], w[1010][1010], e[1010][1010],
    no[1010][1010];
map<char, pair<int, int> > b;
char a[1010][1010], d[100500];
vector<char> ans;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 0; i <= n + 1; i++) {
    for (int j = 0; j <= m + 1; j++) {
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (a[i][j] != '#') {
        s[i][j] = s[i - 1][j] + 1;
        w[i][j] = w[i][j - 1] + 1;
        if (a[i][j] != '.') {
          b[a[i][j]].first = j;
          b[a[i][j]].second = i;
        }
      }
    }
  }
  for (int i = n; i >= 1; i--) {
    for (int j = m; j >= 1; j--) {
      if (a[i][j] != '#') {
        no[i][j] = no[i + 1][j] + 1;
        e[i][j] = e[i][j + 1] + 1;
      }
    }
  }
  cin >> k;
  for (int i = 0; i < k; i++) {
    cin >> d[i] >> l[i];
  }
  for (map<char, pair<int, int> >::iterator it = b.begin(); it != b.end();
       it++) {
    pair<int, int> tmp = it->second;
    int x = tmp.first;
    int y = tmp.second;
    int t = 0;
    for (int i = 0; i < k; i++) {
      if (d[i] == 'S')
        if (no[y][x] > l[i]) {
          t++;
          y += l[i];
        }
      if (d[i] == 'E')
        if (e[y][x] > l[i]) {
          t++;
          x += l[i];
        }
      if (d[i] == 'W')
        if (w[y][x] > l[i]) {
          t++;
          x -= l[i];
        }
      if (d[i] == 'N') {
        if (s[y][x] > l[i]) {
          t++;
          y -= l[i];
        }
      }
    }
    if (t == k) ans.push_back(it->first);
  }
  if (ans.size() == 0) {
    cout << "no solution";
    return 0;
  }
  for (int i = 0; i < ans.size(); i++) cout << ans[i];
  return 0;
}
