#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  vector<vector<int>> vx(n), vy(m);
  vector<pair<int, int>> p;
  vector<vector<char>> s(n, vector<char>(m, '0'));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      cin >> s[i][j];
      if (s[i][j] == '#') {
        vx[i].push_back(j);
        vy[j].push_back(i);
      } else if (s[i][j] != '.')
        p.push_back({i, j});
    }
  int k;
  cin >> k;
  vector<pair<int, int>> pi;
  while (k--) {
    char x;
    int y;
    cin >> x >> y;
    if (x == 'N')
      pi.push_back({0, -y});
    else if (x == 'S')
      pi.push_back({0, y});
    else if (x == 'E')
      pi.push_back({1, y});
    else
      pi.push_back({1, -y});
  }
  string ans;
  for (int i = 0; i < (int)p.size(); i++) {
    int x, y, z = 0;
    x = p[i].first, y = p[i].second;
    for (int j = 0; j < (int)pi.size() && z >= 0; j++) {
      int l = pi[j].second;
      int mi, ma;
      if (pi[j].first == 0) {
        l += x;
        mi = min(l, x);
        ma = max(l, x);
        auto it = lower_bound(vy[y].begin(), vy[y].end(), mi);
        if (l < 0 || l >= n || it == vy[y].end()) {
          z = -1;
          break;
        }
        int h = *it;
        if (h >= mi && h <= ma) {
          z = -1;
          break;
        }
        x = l;
      } else {
        l += y;
        mi = min(l, y);
        ma = max(l, y);
        auto it = lower_bound(vx[x].begin(), vx[x].end(), mi);
        if (l < 0 || l >= m || it == vx[x].end()) {
          z = -1;
          break;
        }
        int h = *it;
        if (h >= mi && h <= ma) {
          z = -1;
          break;
        }
        y = l;
      }
    }
    if (z == 0) ans += s[p[i].first][p[i].second];
  }
  if (ans.size() == 0)
    cout << "no solution\n";
  else {
    sort(ans.begin(), ans.end());
    cout << ans << '\n';
  }
}
