#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
char c[1003][1003];
int n, m;
char d[N];
int l[N];
int k;
int ps[1003][1003], pr[1003][1003];
vector<char> ans;
inline bool ok(int x, int y) {
  int q, w;
  for (int i = 1; i <= k; i++) {
    q = x;
    w = y;
    if (d[i] == 'N') q -= l[i];
    if (d[i] == 'S') q += l[i];
    if (d[i] == 'W') w -= l[i];
    if (d[i] == 'E') w += l[i];
    if (q < 1 || w < 1 || q > n || w > m) return 0;
    if (q == x)
      if (max(ps[x][y] - ps[q][w - 1], ps[q][w] - ps[x][y - 1]) > 0) return 0;
    if (w == y)
      if (max(pr[x][y] - pr[q - 1][w], pr[q][w] - pr[x - 1][y]) > 0) return 0;
    x = q;
    y = w;
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  string s;
  for (int i = 1; i <= n; i++) {
    cin >> s;
    for (int j = 1; j <= m; j++) {
      c[i][j] = s[j - 1];
      ps[i][j] = ps[i][j - 1];
      pr[i][j] = pr[i - 1][j];
      if (c[i][j] == '#') {
        ps[i][j]++;
        pr[i][j]++;
      }
    }
  }
  cin >> k;
  for (int i = 1; i <= k; i++) cin >> d[i] >> l[i];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (c[i][j] >= 'A' && c[i][j] <= 'Z')
        if (ok(i, j)) ans.push_back(c[i][j]);
  sort(ans.begin(), ans.end());
  if (ans.size() == 0)
    cout << "no solution";
  else {
    for (char p : ans) cout << p;
  }
  return 0;
}
