#include <bits/stdc++.h>
using namespace std;
string *s;
int *x, *y;
int **_x, **_y;
bool check(int X, int Y, int n, int m, int k) {
  for (int i = 0; i < k; i++) {
    int xx = X, yy = Y;
    X += x[i];
    Y += y[i];
    if (X < 0 || X >= n || Y < 0 || Y >= m || s[X][Y] == '#') return false;
    if (_x[X][Y] != _x[xx][yy] && xx == X) return false;
    if (_y[X][Y] != _y[xx][yy] && yy == Y) return false;
  }
  return true;
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  s = new string[n];
  for (int i = 0; i < n; i++) cin >> s[i];
  pair<int, int> p[26];
  for (int i = 0; i < 26; i++) p[i] = {-1, -1};
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (s[i][j] >= 'A' && s[i][j] <= 'Z') p[s[i][j] - 'A'] = {i, j};
  _x = new int *[n];
  _y = new int *[n];
  for (int i = 0; i < n; i++) {
    _x[i] = new int[m];
    _y[i] = new int[m];
  }
  for (int i = 0; i < n; i++) {
    _x[i][0] = (s[i][0] == '#');
    for (int j = 1; j < m; j++) {
      _x[i][j] = (s[i][j] == '#');
      _x[i][j] += _x[i][j - 1];
    }
  }
  for (int i = 0; i < m; i++) {
    _y[0][i] = (s[0][i] == '#');
    for (int j = 1; j < n; j++) {
      _y[j][i] = (s[j][i] == '#');
      _y[j][i] += _y[j - 1][i];
    }
  }
  int k;
  scanf("%d", &k);
  x = new int[k];
  y = new int[k];
  for (int i = 0; i < k; i++) {
    char c;
    int t;
    scanf("\n%c%d", &c, &t);
    x[i] = y[i] = 0;
    if (c == 'N')
      x[i] = -t;
    else if (c == 'S')
      x[i] = t;
    else if (c == 'E')
      y[i] = t;
    else if (c == 'W')
      y[i] = -t;
  }
  bool key = false;
  for (int i = 0; i < 26; i++) {
    if (p[i].first == -1 && p[i].second == -1) continue;
    if (check(p[i].first, p[i].second, n, m, k))
      printf("%c", 'A' + i), key = true;
  }
  if (!key) printf("no solution\n");
  return 0;
}
