#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse4")
#pragma GCC optimize("unroll-loops")
using namespace std;
string A[1005];
pair<char, int> mv[100005];
int X[4][1005][1005];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, i, j, k, l, r, c;
  string res;
  cin >> n >> m;
  for (i = 0; i < n; i++) cin >> A[i];
  for (i = 0; i < n; i++)
    for (j = 1; j < m; j++)
      if (A[i][j - 1] != '#') X[0][i][j] = 1 + X[0][i][j - 1];
  for (i = 0; i < n; i++)
    for (j = m - 2; j >= 0; j--)
      if (A[i][j + 1] != '#') X[1][i][j] = 1 + X[1][i][j + 1];
  for (j = 0; j < m; j++)
    for (i = 1; i < n; i++)
      if (A[i - 1][j] != '#') X[2][i][j] = 1 + X[2][i - 1][j];
  for (j = 0; j < m; j++)
    for (i = n - 2; i >= 0; i--)
      if (A[i + 1][j] != '#') X[3][i][j] = 1 + X[3][i + 1][j];
  cin >> k;
  for (i = 0; i < k; i++) cin >> mv[i].first >> mv[i].second;
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++)
      if (isupper(A[i][j])) {
        r = i, c = j;
        for (l = 0; l < k; l++)
          if (mv[l].first == 'W' and X[0][r][c] >= mv[l].second)
            c -= mv[l].second;
          else if (mv[l].first == 'E' and X[1][r][c] >= mv[l].second)
            c += mv[l].second;
          else if (mv[l].first == 'N' and X[2][r][c] >= mv[l].second)
            r -= mv[l].second;
          else if (mv[l].first == 'S' and X[3][r][c] >= mv[l].second)
            r += mv[l].second;
          else
            break;
        if (l == k) res.push_back(A[i][j]);
      }
  sort((res).begin(), (res).end());
  if (res.empty())
    cout << "no solution";
  else
    cout << res;
  return 0;
}
