#include <bits/stdc++.h>
using namespace std;
int a[1001][1001];
vector<pair<pair<int, int>, char> > start;
int row[1001][1001], col[1001][1001];
pair<char, int> dir[100001];
vector<char> ans;
void init() {
  for (int i = 0; i < 1001; i++) {
    for (int j = 0; j < 1001; j++) a[i][j] = -1;
  }
}
int main() {
  int i, j, n, m, x, y, k, len, f;
  string str;
  cin >> n >> m;
  init();
  for (i = 1; i <= n; i++) {
    cin >> str;
    str = " " + str;
    for (j = 1; j <= m; j++) {
      if (str[j] == '#')
        a[i][j] = -1;
      else if (str[j] == '.')
        a[i][j] = 0;
      else {
        start.push_back(make_pair(make_pair(i, j), str[j]));
        a[i][j] = 0;
      }
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) row[i][j] = row[i][j - 1] + a[i][j];
  }
  for (j = 1; j <= m; j++) {
    for (i = 1; i <= n; i++) col[j][i] = col[j][i - 1] + a[i][j];
  }
  cin >> k;
  for (i = 1; i <= k; i++) cin >> dir[i].first >> dir[i].second;
  for (i = 0; i < start.size(); i++) {
    x = start[i].first.first;
    y = start[i].first.second;
    f = 0;
    for (j = 1; j <= k; j++) {
      len = dir[j].second;
      if (dir[j].first == 'N') {
        if (x - len < 1) {
          f = 1;
          break;
        } else if (col[y][x] - col[y][x - len - 1] != 0) {
          f = 1;
          break;
        } else
          x = x - len;
      } else if (dir[j].first == 'S') {
        if (x + len > n) {
          f = 1;
          break;
        } else if (col[y][x + len] - col[y][x - 1] != 0) {
          f = 1;
          break;
        } else
          x = x + len;
      } else if (dir[j].first == 'E') {
        if (y + len > m) {
          f = 1;
          break;
        } else if (row[x][y + len] - row[x][y - 1] != 0) {
          f = 1;
          break;
        } else
          y = y + len;
      } else {
        if (y - len < 1) {
          f = 1;
          break;
        } else if (row[x][y] - row[x][y - len - 1] != 0) {
          f = 1;
          break;
        } else
          y = y - len;
      }
    }
    if (!f) ans.push_back(start[i].second);
  }
  if (!ans.size()) {
    cout << "no solution";
    return 0;
  }
  sort(ans.begin(), ans.end());
  for (i = 0; i < ans.size(); i++) cout << ans[i];
  return 0;
}
