#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:64000000")
int n, m;
int k;
char buf[1 << 10];
char c[1 << 10][1 << 10];
int a[1 << 10][1 << 10];
int col[1 << 10][1 << 10];
int line[1 << 10][1 << 10];
pair<char, int> q[1 << 17];
inline int getLine(int ind, int l, int r) {
  int res = line[ind][r];
  if (l) res -= line[ind][l - 1];
  return res;
}
inline int getCol(int ind, int l, int r) {
  int res = col[ind][r];
  if (l) res -= col[ind][l - 1];
  return res;
}
inline void init() {
  scanf("%d%d", &n, &m);
  gets(buf);
  for (int i = 0; i < n; ++i) {
    gets(buf);
    for (int j = 0; j < m; ++j) {
      c[i][j] = buf[j];
      a[i][j] = 0;
      if (c[i][j] == '#') a[i][j] = 1;
    }
  }
  scanf("%d", &k);
  gets(buf);
  for (int i = 0; i < k; ++i) {
    scanf("%c %d", &q[i].first, &q[i].second);
    gets(buf);
  }
}
inline int check(int x, int y) { return (x >= 0 && y >= 0 && x < n && y < m); }
inline int go(int x, int y) {
  int dx, dy;
  int nx, ny;
  for (int i = 0; i < k; ++i) {
    if (q[i].first == 'N' || q[i].first == 'S') {
      dy = 0;
      dx = q[i].second;
      if (q[i].first == 'N') dx = -dx;
      nx = x + dx;
      ny = y + dy;
      if (!check(nx, ny)) return 0;
      if (getCol(y, min(x, nx), max(x, nx))) return 0;
    } else {
      dx = 0;
      dy = q[i].second;
      if (q[i].first == 'W') dy = -dy;
      nx = x + dx;
      ny = y + dy;
      if (!check(nx, ny)) return 0;
      if (getLine(x, min(y, ny), max(y, ny))) return 0;
    }
    x = nx;
    y = ny;
  }
  return 1;
}
string ans;
int main() {
  init();
  for (int j = 0; j < m; ++j) {
    col[j][0] = a[0][j];
    for (int i = 1; i < n; ++i) col[j][i] = col[j][i - 1] + a[i][j];
  }
  for (int i = 0; i < n; ++i) {
    line[i][0] = a[i][0];
    for (int j = 1; j < m; ++j) line[i][j] = line[i][j - 1] + a[i][j];
  }
  ans = "";
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) {
      if (c[i][j] >= 'A' && c[i][j] <= 'Z') {
        int cur = go(i, j);
        if (!cur) continue;
        ans += c[i][j];
      }
    }
  if (ans == "")
    ans = "no solution";
  else
    sort(ans.begin(), ans.end());
  puts(ans.c_str());
  return 0;
}
