#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
bool ISINT(double x) { return fabs(x - (int)x) < EPS; }
bool ISEQ(double x, double y) { return fabs(x - y) < EPS; }
string itos(long long x) {
  stringstream ss;
  ss << x;
  return ss.str();
}
bool pass[3000][3000];
char t[1002][1002];
int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
int main(void) {
  int h, w;
  vector<pair<int, int> > sight;
  char dir[128];
  dir['N'] = 0;
  dir['E'] = 1;
  dir['S'] = 2;
  dir['W'] = 3;
  scanf("%d%d", &h, &w);
  for (int i = 0; i < h; i++) {
    scanf("%s", t[i]);
    for (int j = 0; j < w; j++) {
      if (isalpha(t[i][j])) {
        sight.push_back(pair<int, int>(j, i));
      }
    }
  }
  memset(pass, 0, sizeof(pass));
  int k;
  int x = 1500, y = 1500;
  int lx = 1500, ly = 1500, hx = 1500, hy = 1500;
  scanf("%d", &k);
  for (int i = 0; i < k; i++) {
    char s[2];
    int dist;
    scanf("%s%d", s, &dist);
    int d = dir[s[0]];
    int rd = (d + 2) % 4;
    int nx = x + dist * dx[d];
    int ny = y + dist * dy[d];
    if (0 > nx || nx >= 3000 || 0 > ny || ny >= 3000) {
      cout << "no solution\n";
      return 0;
    }
    if (!pass[ny][nx]) {
      int sx = nx;
      int sy = ny;
      while (!pass[sy][sx]) {
        pass[sy][sx] = true;
        if (x == sx && y == sy) break;
        sx += dx[rd];
        sy += dy[rd];
      }
    }
    x = nx;
    y = ny;
    lx = min(lx, x);
    ly = min(ly, y);
    hx = max(hx, x);
    hy = max(hy, y);
  }
  if (sight.empty()) {
    cout << "no solution\n";
    return 0;
  }
  vector<char> ans;
  for (int i = 0; i < sight.size(); i++) {
    int x = sight[i].first;
    int y = sight[i].second;
    int left = x - (1500 - lx);
    int right = x + (hx - 1500);
    int top = y - (1500 - ly);
    int bottom = y + (hy - 1500);
    if (left < 0 || right >= w || top < 0 || bottom >= h) {
      continue;
    }
    bool flg = true;
    for (int i = top, ii = ly; i <= bottom; i++, ii++) {
      for (int j = left, jj = lx; j <= right; j++, jj++) {
        if (pass[ii][jj] && t[i][j] == '#') {
          flg = false;
          break;
        }
      }
      if (!flg) break;
    }
    if (flg) ans.push_back(t[y][x]);
  }
  if (ans.empty()) {
    cout << "no solution\n";
  } else {
    sort(ans.begin(), ans.end());
    for (int i = 0; i < ans.size(); i++) cout << ans[i];
    cout << endl;
  }
}
