#include <bits/stdc++.h>
using namespace std;
const long double epsilon = 1e-9;
int dirs[1024][1024][4];
int main() {
  int n, m;
  cin >> n >> m;
  vector<string> map1(n);
  for (int i = 0; i < n; i++) cin >> map1[i];
  vector<pair<int, int> > sights;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (isalpha(map1[i][j])) {
        sights.push_back(make_pair(i, j));
      }
    }
  }
  char pos[4] = {'E', 'W', 'S', 'N'};
  map<char, int> mp;
  mp['W'] = 0;
  mp['E'] = 1;
  mp['N'] = 2;
  mp['S'] = 3;
  map<char, pair<int, int> > mvs;
  mvs['W'] = make_pair(0, -1);
  mvs['E'] = make_pair(0, 1);
  mvs['N'] = make_pair(-1, 0);
  mvs['S'] = make_pair(1, 0);
  memset(dirs, 0, sizeof(dirs));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (map1[i][j] != '#')
        dirs[i][j][0] = dirs[i][j - 1][0] + 1;
      else
        dirs[i][j][0] = 0;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = m - 1; j >= 0; j--) {
      if (map1[i][j] != '#')
        dirs[i][j][1] = dirs[i][j + 1][1] + 1;
      else
        dirs[i][j][1] = 0;
    }
  }
  for (int j = 0; j < m; j++) {
    for (int i = 0; i < n; i++) {
      if (map1[i][j] != '#')
        dirs[i][j][2] = dirs[i - 1][j][2] + 1;
      else
        dirs[i][j][2] = 0;
    }
  }
  for (int j = 0; j < m; j++) {
    for (int i = n - 1; i >= 0; i--) {
      if (map1[i][j] != '#')
        dirs[i][j][3] = dirs[i + 1][j][3] + 1;
      else
        dirs[i][j][3] = 0;
    }
  }
  int k;
  cin >> k;
  vector<pair<char, int> > moves(k);
  for (int i = 0; i < k; i++) {
    cin >> moves[i].first >> moves[i].second;
  }
  bool used[32];
  memset(used, 0, sizeof(used));
  for (int i = 0; i < sights.size(); i++) {
    bool does = true;
    int x = sights[i].first;
    int y = sights[i].second;
    for (int j = 0; j < k; j++) {
      if (dirs[x][y][mp[moves[j].first]] > moves[j].second) {
        x += mvs[moves[j].first].first * moves[j].second;
        y += mvs[moves[j].first].second * moves[j].second;
      } else {
        does = false;
        break;
      }
    }
    if (does) used[map1[sights[i].first][sights[i].second] - 'A'] = true;
  }
  string res;
  for (int i = 0; i < 26; i++)
    if (used[i]) res.push_back('A' + i);
  if (res.size() > 0)
    cout << res << endl;
  else
    cout << "no solution" << endl;
  return 0;
}
