#include <bits/stdc++.h>
using namespace std;
char g[1002][1002];
int north[1002][1002];
int south[1002][1002];
int west[1002][1002];
int east[1002][1002];
vector<pair<int, int> > pos;
int main() {
  cin.sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> (g[i] + 1);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      if (g[i][j] == '#')
        north[i][j] = -1;
      else
        north[i][j] = north[i - 1][j] + 1;
      if (g[i][j] >= 'A' and g[i][j] <= 'Z') pos.push_back({i, j});
    }
  for (int i = n; i >= 1; i--)
    for (int j = 1; j <= m; j++) {
      if (g[i][j] == '#')
        south[i][j] = -1;
      else
        south[i][j] = south[i + 1][j] + 1;
    }
  for (int i = 0; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      if (g[i][j] == '#')
        west[i][j] = -1;
      else
        west[i][j] = west[i][j - 1] + 1;
    }
  for (int i = 0; i <= n; i++)
    for (int j = m; j >= 1; j--) {
      if (g[i][j] == '#')
        east[i][j] = -1;
      else
        east[i][j] = east[i][j + 1] + 1;
    }
  int k;
  cin >> k;
  vector<pair<int, int> > cpy = pos;
  while (k--) {
    char dir;
    int steps;
    cin >> dir >> steps;
    for (int i = 0; i < pos.size(); i++) {
      if (pos[i].first == -1) continue;
      if (dir == 'N') {
        if (north[pos[i].first][pos[i].second] >= steps)
          pos[i].first -= steps;
        else
          pos[i].first = -1;
      } else if (dir == 'S') {
        if (south[pos[i].first][pos[i].second] >= steps)
          pos[i].first += steps;
        else
          pos[i].first = -1;
      } else if (dir == 'E') {
        if (east[pos[i].first][pos[i].second] >= steps)
          pos[i].second += steps;
        else
          pos[i].first = -1;
      } else {
        if (west[pos[i].first][pos[i].second] >= steps)
          pos[i].second -= steps;
        else
          pos[i].first = -1;
      }
    }
  }
  string ans = "";
  for (int i = 0; i < pos.size(); i++)
    if (pos[i].first != -1) ans += g[cpy[i].first][cpy[i].second];
  if (ans.size())
    sort(ans.begin(), ans.end()), cout << ans;
  else
    cout << "no solution";
  return 0;
}
