#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
int N, M, K;
char mat[MAXN][MAXN];
int row[MAXN][MAXN], col[MAXN][MAXN];
vector<pair<char, pair<int, int> > > pos;
vector<pair<char, int> > ins;
void update(int *tree, int idx, int x) {
  idx += 3;
  while (idx < MAXN) {
    tree[idx] += x;
    idx += (idx & -idx);
  }
}
int read(int *tree, int idx) {
  int ret = 0;
  idx += 3;
  while (idx > 0) {
    ret += tree[idx];
    idx -= (idx & -idx);
  }
  return ret;
}
inline bool go(int r, int c) {
  int nr = r, nc = c;
  for (int i = 0, _i = K; i < _i; ++i) {
    if (ins[i].first == 'N' || ins[i].first == 'S') {
      nr += (ins[i].first == 'N' ? -1 : 1) * ins[i].second;
    } else {
      nc += (ins[i].first == 'W' ? -1 : 1) * ins[i].second;
    }
    if (nr >= N || nr < 0 || nc >= M || nc < 0) {
      return false;
    }
    if (ins[i].first == 'N' || ins[i].first == 'S') {
      if (read(col[c], max(nr, r)) - read(col[c], min(nr, r) - 1) != 0)
        return false;
    } else {
      if (read(row[r], max(nc, c)) - read(row[r], min(nc, c) - 1) != 0)
        return false;
    }
    r = nr;
    c = nc;
  }
  return true;
}
int main(int argc, char *argv[]) {
  scanf("%d%d", &N, &M);
  for (int i = 0, _i = N; i < _i; ++i) {
    scanf("%s", mat[i]);
    for (int j = 0, _j = M; j < _j; ++j) {
      if (mat[i][j] == '#') {
        update(row[i], j, 1);
      } else if (isalpha(mat[i][j])) {
        pos.push_back(
            pair<char, pair<int, int> >(mat[i][j], pair<int, int>(i, j)));
      }
    }
  }
  for (int i = 0, _i = M; i < _i; ++i) {
    for (int j = 0, _j = N; j < _j; ++j) {
      if (mat[j][i] == '#') {
        update(col[i], j, 1);
      }
    }
  }
  scanf("%d", &K);
  for (int i = 0, _i = K; i < _i; ++i) {
    char str[3];
    int x;
    scanf("%s %d", str, &x);
    ins.push_back(pair<char, int>(*str, x));
  }
  vector<char> ans;
  for (int i = 0, _i = pos.size(); i < _i; ++i) {
    if (go(pos[i].second.first, pos[i].second.second))
      ans.push_back(pos[i].first);
  }
  if (ans.empty()) {
    printf("no solution\n");
  } else {
    sort(ans.begin(), ans.end());
    for (int i = 0, _i = ans.size(); i < _i; ++i) {
      putchar(ans[i]);
    }
  }
  return 0;
}
