#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y;
  char c;
  node(int p, int q, char r) : x(p), y(q), c(r) {}
};
vector<node> sight;
vector<pair<char, int> > ins;
vector<char> ans;
int n, m, k;
char mp[1000][1000], s[1000];
int up[1000][1000], lt[1000][1000];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    for (int j = 0; j < m; j++) {
      mp[i][j] = s[j];
      if (j > 0 && mp[i][j - 1] != '#' && mp[i][j] != '#') {
        lt[i][j] = lt[i][j - 1] + 1;
      }
      if (i > 0 && mp[i - 1][j] != '#' && mp[i][j] != '#') {
        up[i][j] = up[i - 1][j] + 1;
      }
    }
  }
  scanf("%d", &k);
  for (int i = 0; i < k; i++) {
    char a;
    int b;
    cin >> a >> b;
    ins.push_back(make_pair(a, b));
  }
  string ans = "";
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      if (mp[i][j] >= 'A' && mp[i][j] <= 'Z') {
        int r = i, c = j;
        bool ck = true;
        for (int l = 0; l < ins.size(); l++) {
          char dir = ins[l].first;
          int dis = ins[l].second;
          if (dir == 'N' && dis <= up[r][c])
            r -= dis;
          else if (dir == 'S' && r + dis < n && up[r + dis][c] >= dis)
            r += dis;
          else if (dir == 'W' && dis <= lt[r][c])
            c -= dis;
          else if (dir == 'E' && c + dis < m && lt[r][c + dis] >= dis)
            c += dis;
          else {
            ck = false;
            break;
          }
        }
        if (ck) ans += mp[i][j];
      }
    }
  sort(ans.begin(), ans.end());
  if (ans.size() > 0)
    puts(ans.c_str());
  else
    puts("no solution");
  return 0;
}
