#include <bits/stdc++.h>
using namespace std;
string mas[1010];
int gor[1010][1010], ver[1010][1010];
int main() {
  int n, m, k;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> mas[i];
  for (int i = 0; i < n; i++) {
    gor[i][0] = (mas[i][0] == '#');
    for (int j = 1; j < m; j++) gor[i][j] = gor[i][j - 1] + (mas[i][j] == '#');
  }
  for (int j = 0; j < m; j++) {
    ver[j][0] = (mas[0][j] == '#');
    for (int i = 1; i < n; i++) ver[j][i] = ver[j][i - 1] + (mas[i][j] == '#');
  }
  cin >> k;
  vector<pair<char, int> > v;
  for (int i = 0; i < k; i++) {
    char dir;
    int d;
    cin >> dir >> d;
    v.push_back(make_pair(dir, d));
  }
  string ans = "";
  for (int i = 1; i < n - 1; i++) {
    for (int j = 1; j < m - 1; j++) {
      if (mas[i][j] >= 'A' && mas[i][j] <= 'Z') {
        int x = i, y = j;
        bool fl = true;
        for (int kk = 0; kk < k; kk++) {
          int xx = x, yy = y;
          if (v[kk].first == 'N') {
            xx = x - v[kk].second;
            if (xx < 0) {
              fl = false;
              break;
            }
            if (ver[y][x] - ver[y][xx] + (mas[xx][y] == '#') > 0) {
              fl = false;
              break;
            }
          } else if (v[kk].first == 'S') {
            xx = x + v[kk].second;
            if (xx >= n) {
              fl = false;
              break;
            }
            if (ver[y][xx] - ver[y][x] + (mas[x][y] == '#') > 0) {
              fl = false;
              break;
            }
          } else if (v[kk].first == 'W') {
            yy = y - v[kk].second;
            if (yy < 0) {
              fl = false;
              break;
            }
            if (gor[x][y] - gor[x][yy] + (mas[x][yy] == '#') > 0) {
              fl = false;
              break;
            }
          } else {
            yy = y + v[kk].second;
            if (yy >= m) {
              fl = false;
              break;
            }
            if (gor[x][yy] - gor[x][y] + (mas[x][y] == '#') > 0) {
              fl = false;
              break;
            }
          }
          x = xx;
          y = yy;
        }
        if (fl) ans += mas[i][j];
      }
    }
  }
  if ((int)ans.size()) {
    sort(ans.begin(), ans.end());
    cout << ans;
  } else
    cout << "no solution";
  return 0;
}
