#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n;
  cin >> m >> n;
  char map[m][n];
  for (int i = 0; i < m; i++)
    for (int j = 0; j < n; j++) cin >> map[i][j];
  int k;
  cin >> k;
  pair<char, int> istr[k];
  for (int i = 0; i < k; i++) {
    cin >> istr[i].first >> istr[i].second;
  }
  int howfar[m][n][4];
  for (int i = 0; i < m; i++)
    for (int j = 0; j < n; j++)
      for (int l = 0; l < 4; l++)
        if (map[i][j] == '#')
          howfar[i][j][l] = -1;
        else
          howfar[i][j][l] = 0;
  for (int i = 1; i < m; i++) {
    for (int j = 0; j < n; j++) {
      if (map[i][j] == '#')
        howfar[i][j][0] = -1;
      else
        howfar[i][j][0] = howfar[i - 1][j][0] + 1;
    }
  }
  for (int i = 0; i < m; i++) {
    for (int j = n - 2; j >= 0; j--) {
      if (map[i][j] == '#')
        howfar[i][j][1] = -1;
      else
        howfar[i][j][1] = howfar[i][j + 1][1] + 1;
    }
  }
  for (int i = m - 2; i >= 0; i--) {
    for (int j = 0; j < n; j++) {
      if (map[i][j] == '#')
        howfar[i][j][2] = -1;
      else
        howfar[i][j][2] = howfar[i + 1][j][2] + 1;
    }
  }
  for (int i = 0; i < m; i++) {
    for (int j = 1; j < n; j++) {
      if (map[i][j] == '#')
        howfar[i][j][3] = -1;
      else
        howfar[i][j][3] = howfar[i][j - 1][3] + 1;
    }
  }
  vector<char> ans;
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) {
      if (map[i][j] < 'A' or map[i][j] > 'Z') continue;
      int y = i, x = j;
      bool ok = true;
      for (int l = 0; l < k and ok; l++) {
        if (istr[l].first == 'N' and howfar[y][x][0] >= istr[l].second) {
          y -= istr[l].second;
        } else if (istr[l].first == 'E' and howfar[y][x][1] >= istr[l].second) {
          x += istr[l].second;
        } else if (istr[l].first == 'S' and howfar[y][x][2] >= istr[l].second) {
          y += istr[l].second;
        } else if (istr[l].first == 'W' and howfar[y][x][3] >= istr[l].second) {
          x -= istr[l].second;
        } else {
          ok = false;
        }
      }
      if (ok) ans.push_back(map[i][j]);
    }
  }
  sort(ans.begin(), ans.end());
  if (ans.size() == 0)
    cout << "no solution";
  else
    for (int i = 0; i < ans.size(); i++) cout << ans[i];
}
