#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
const int GOX[] = {-1, 1, 0, 0};
const int GOY[] = {0, 0, -1, 1};
struct moves {
  char nup;
  int len;
};
struct coord {
  int x, y;
  coord(int X = 0, int Y = 0) {
    x = X;
    y = Y;
  }
  void operator+=(moves p) {
    x += GOX[p.nup] * p.len;
    y += GOY[p.nup] * p.len;
  }
};
char x;
int b[N][N], num[256];
coord start[27];
moves a[N * N / 10];
int n, m, k;
bool canMove(int x1, int y1, int x2, int y2) {
  if (x1 > x2) swap(x1, x2);
  if (y1 > y2) swap(y1, y2);
  if (x1 <= 0 || y1 <= 0 || x2 > n || y2 > m) return false;
  return b[x2][y2] - b[x1 - 1][y2] - b[x2][y1 - 1] + b[x1 - 1][y1 - 1] == 0;
}
bool correctPath(coord st) {
  bool correct = true;
  coord now = st, pr;
  for (int i = 0; i < k && correct; i++) {
    pr = now;
    now += a[i];
    correct &= canMove(pr.x, pr.y, now.x, now.y);
  }
  return correct;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      cin >> x;
      if (isalpha(x)) start[x - 'A'] = coord(i, j);
      b[i][j] = (x == '#') + b[i - 1][j] + b[i][j - 1] - b[i - 1][j - 1];
    }
  num['N'] = 0;
  num['S'] = 1;
  num['W'] = 2;
  num['E'] = 3;
  cin >> k;
  for (int i = 0; i < k; i++) {
    cin >> a[i].nup >> a[i].len;
    a[i].nup = num[a[i].nup];
  }
  bool sol = false;
  for (int i = 0; i < 26; i++)
    if (correctPath(start[i])) {
      cout << char(i + 'A');
      sol = true;
    }
  if (!sol) cout << "no solution";
  return 0;
}
