#include <bits/stdc++.h>
using namespace std;
const int inf = (1 << 30);
const int MX = 1009;
int n, m, k, s[MX * 100];
char a[MX][MX], c[MX * 100];
int l[MX][MX];
int r[MX][MX];
int u[MX][MX];
int d[MX][MX];
int DPL(int x, int y) {
  if (a[x][y] == '#' || y < 0) return -1;
  if (l[x][y] != -1) return l[x][y];
  return l[x][y] = DPL(x, y - 1) + 1;
}
int DPR(int x, int y) {
  if (a[x][y] == '#' || y >= m) return -1;
  if (r[x][y] != -1) return r[x][y];
  return r[x][y] = DPR(x, y + 1) + 1;
}
int DPU(int x, int y) {
  if (a[x][y] == '#' || x < 0) return -1;
  if (u[x][y] != -1) return u[x][y];
  return u[x][y] = DPU(x - 1, y) + 1;
}
int DPD(int x, int y) {
  if (a[x][y] == '#' || x >= n) return -1;
  if (d[x][y] != -1) return d[x][y];
  return d[x][y] = DPD(x + 1, y) + 1;
}
bool OK(int x, int y) {
  for (int i = 0; i < k; i++) {
    if (c[i] == 'N') {
      if (s[i] > u[x][y]) return 0;
      x -= s[i];
    }
    if (c[i] == 'S') {
      if (s[i] > d[x][y]) return 0;
      x += s[i];
    }
    if (c[i] == 'E') {
      if (s[i] > r[x][y]) return 0;
      y += s[i];
    }
    if (c[i] == 'W') {
      if (s[i] > l[x][y]) return 0;
      y -= s[i];
    }
  }
  return 1;
}
vector<pair<int, int> > v;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%s", &a[i]);
  memset(l, -1, sizeof(l));
  memset(r, -1, sizeof(r));
  memset(u, -1, sizeof(u));
  memset(d, -1, sizeof(d));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (a[i][j] == '#') continue;
      l[i][j] = DPL(i, j);
      r[i][j] = DPR(i, j);
      u[i][j] = DPU(i, j);
      d[i][j] = DPD(i, j);
      if (a[i][j] == '.' || a[i][j] == '#') continue;
      v.push_back({i, j});
    }
  }
  vector<char> ans;
  scanf("%d", &k);
  for (int i = 0; i < k; i++) scanf("%s %d", &c[i], &s[i]);
  for (auto pp : v) {
    if (OK(pp.first, pp.second)) {
      ans.push_back(a[pp.first][pp.second]);
    }
  }
  if (ans.empty()) {
    puts("no solution");
    return 0;
  }
  sort(ans.begin(), ans.end());
  for (auto pp : ans) cout << pp;
}
