#include <bits/stdc++.h>
using namespace std;
int k, ver[1003], L[1003][1003], R[1003][1003], U[1003][1003], D[1003][1003];
char mp[1003][1003];
pair<char, int> ins[100005];
pair<int, int> st[26];
vector<char> ans;
bool check(int sr, int sc) {
  int r = sr, c = sc;
  for (int i = 0; i < k; i++) {
    int nr = r, nc = c;
    if (ins[i].first == 'N') {
      if (U[r][c] <= ins[i].second) return false;
      nr -= ins[i].second;
    } else if (ins[i].first == 'S') {
      if (D[r][c] <= ins[i].second) return false;
      nr += ins[i].second;
    } else if (ins[i].first == 'W') {
      if (L[r][c] <= ins[i].second) return false;
      nc -= ins[i].second;
    } else {
      if (R[r][c] <= ins[i].second) return false;
      nc += ins[i].second;
    }
    r = nr;
    c = nc;
  }
  return true;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    int hor = 0;
    for (int j = 1; j <= m; j++) {
      scanf(" %c", &mp[i][j]);
      if (mp[i][j] == '#') {
        ver[j] = 0;
        hor = 0;
      } else {
        ver[j]++;
        hor++;
        if (mp[i][j] >= 'A' && mp[i][j] <= 'Z') {
          st[mp[i][j] - 'A'].first = i;
          st[mp[i][j] - 'A'].second = j;
        }
      }
      L[i][j] = hor;
      U[i][j] = ver[j];
    }
  }
  memset(ver, 0, sizeof(ver));
  for (int i = n; i > 0; i--) {
    int hor = 0;
    for (int j = m; j > 0; j--) {
      if (mp[i][j] == '#') {
        ver[j] = 0;
        hor = 0;
      } else {
        ver[j]++;
        hor++;
      }
      R[i][j] = hor;
      D[i][j] = ver[j];
    }
  }
  scanf("%d", &k);
  for (int i = 0; i < k; i++) scanf(" %c%d", &ins[i].first, &ins[i].second);
  for (int i = 0; i < 26; i++) {
    if (st[i].first > 0 && st[i].second > 0) {
      if (check(st[i].first, st[i].second)) ans.push_back(i + 'A');
    }
  }
  sort(ans.begin(), ans.end());
  if (ans.empty())
    printf("no solution\n");
  else {
    for (char c : ans) printf("%c", c);
    printf("\n");
  }
}
