#include <bits/stdc++.h>
using namespace std;
const int xd[] = {-1, 0, 1, 0};
const int yd[] = {0, 1, 0, -1};
bool stm[256];
char gao[1024][1024];
int mp[1024][1024][4];
pair<int, int> its[102400];
vector<pair<int, int> > togao;
vector<char> togaon;
int main() {
  int n, m, ins, step;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    getchar();
    for (int j = 0; j < m; ++j)
      if (isupper(gao[i][j] = getchar())) {
        togao.push_back(pair<int, int>(i, j));
        togaon.push_back(gao[i][j]);
      }
  }
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) {
      if (gao[i][j] != '#') {
        mp[i][j][0] = mp[i - 1][j][0] + 1;
        mp[i][j][3] = mp[i][j - 1][3] + 1;
      } else
        mp[i][j][3] = mp[i][j][0] = -1;
    }
  for (int i = n; --i >= 0;)
    for (int j = m; --j >= 0;) {
      if (gao[i][j] != '#') {
        mp[i][j][1] = mp[i][j + 1][1] + 1;
        mp[i][j][2] = mp[i + 1][j][2] + 1;
      } else
        mp[i][j][2] = mp[i][j][1] = -1;
    }
  scanf("%d", &ins);
  for (int i = 0; i < ins; ++i) {
    getchar();
    char dir = getchar();
    scanf("%d", &step);
    switch (dir) {
      case 'E':
        its[i] = pair<int, int>(1, step);
        break;
      case 'N':
        its[i] = pair<int, int>(0, step);
        break;
      case 'S':
        its[i] = pair<int, int>(2, step);
        break;
      case 'W':
        its[i] = pair<int, int>(3, step);
        break;
      default:
        break;
    }
  }
  vector<char> ans;
  for (int i = 0; i < togao.size(); ++i) {
    int x = togao[i].first;
    int y = togao[i].second;
    bool flag = true;
    for (int j = 0; j < ins; ++j)
      if (its[j].second > mp[x][y][its[j].first]) {
        flag = false;
        break;
      } else {
        x += its[j].second * xd[its[j].first];
        y += its[j].second * yd[its[j].first];
      }
    if (flag) ans.push_back(togaon[i]);
  }
  if (ans.size() == 0) {
    puts("no solution");
    return 0;
  }
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); ++i) putchar(ans[i]);
  puts("");
}
