#include <bits/stdc++.h>
using namespace std;
using LL = long long;
void Print() { cout << endl; }
template <typename T1, typename... T>
void Print(const T1 &t1, const T &...t) {
  cout << t1 << " ";
  Print(t...);
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <class Iterator>
ostream &output_cantainer(ostream &os, Iterator first, Iterator last,
                          bool space = true) {
  if (space) {
    for (Iterator it = first; it != last; it++) {
      os << (*it) << ' ';
    }
    os << endl;
  } else
    for (Iterator it = first; it != last; it++) {
      os << (*it) << endl;
    }
  return os;
}
const int N = 1005, L = 1e5 + 7;
char dir[L], mp[N][N], ans[30], anssiz;
int dis[L], dp[4][N][N], n, m, k;
void process() {
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      dp[0][i][j] = (mp[i][j] == '#') ? 0 : (1 + ((j) ? dp[0][i][j - 1] : 0));
  for (int i = 0; i < n; i++)
    for (int j = m - 1; j >= 0; j--)
      dp[1][i][j] =
          (mp[i][j] == '#') ? 0 : (1 + ((j < m - 1) ? dp[1][i][j + 1] : 0));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      dp[2][i][j] = (mp[i][j] == '#') ? 0 : (1 + ((i) ? dp[2][i - 1][j] : 0));
  for (int i = n - 1; i >= 0; i--)
    for (int j = 0; j < m; j++)
      dp[3][i][j] =
          (mp[i][j] == '#') ? 0 : (1 + ((i < n - 1) ? dp[3][i + 1][j] : 0));
}
bool check(int x, int y) {
  for (int i = 0; i < k; i++) {
    if (dir[i] == 'W' && dp[0][x][y] > dis[i]) {
      y -= dis[i];
    } else if (dir[i] == 'E' && dp[1][x][y] > dis[i]) {
      y += dis[i];
    } else if (dir[i] == 'N' && dp[2][x][y] > dis[i]) {
      x -= dis[i];
    } else if (dir[i] == 'S' && dp[3][x][y] > dis[i]) {
      x += dis[i];
    } else
      return false;
  }
  return true;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%s", mp[i]);
  scanf("%d", &k);
  for (int i = 0; i < k; i++) scanf(" %c %d", dir + i, dis + i);
  process();
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (mp[i][j] >= 'A' && mp[i][j] <= 'Z' && check(i, j)) {
        ans[anssiz++] = mp[i][j];
      }
    }
  }
  sort(ans, ans + anssiz);
  if (anssiz)
    puts(ans);
  else
    puts("no solution");
}
