#include <bits/stdc++.h>
using namespace std;
const int MX = 1001;
int arr[MX][MX], n, m, let = 0, I;
pair<char, int> instr[1 << 20];
char symb[MX], ch;
pair<int, int> pos[MX];
vector<char> sol;
int SUM(int x1, int y1, int x2, int y2) {
  if (x1 > x2 || y1 > y2) {
    swap(x1, x2);
    swap(y1, y2);
  }
  return arr[x2][y2] + arr[x1 - 1][y1 - 1] - arr[x2][y1 - 1] - arr[x1 - 1][y2];
}
bool check(int idx) {
  int x = pos[idx].first, y = pos[idx].second, dx, dy, nx, ny;
  for (int j = 1; j <= I; j++) {
    if (instr[j].first == 'S' || instr[j].first == 'N') {
      dy = 0;
      dx = instr[j].first == 'S' ? 1 : -1;
    }
    if (instr[j].first == 'E' || instr[j].first == 'W') {
      dx = 0;
      dy = instr[j].first == 'E' ? 1 : -1;
    }
    nx = x + dx * instr[j].second, ny = y + dy * instr[j].second;
    if (!nx || !ny || nx > n || ny > m) return false;
    if (SUM(x, y, nx, ny)) return false;
    x = nx, y = ny;
  }
  return true;
}
int main() {
  memset(arr, 0, sizeof(arr));
  cin >> n >> m;
  for (int j = 1; j <= n; j++) {
    for (int i = 1; i <= m; i++) {
      cin >> ch;
      if (isalpha(ch)) {
        ++let;
        symb[let] = ch;
        pos[let] = make_pair(j, i);
      }
      if (ch == '#')
        arr[j][i] = 1;
      else
        arr[j][i] = 0;
    }
  }
  for (int j = 1; j <= n; j++)
    for (int i = 1; i <= m; i++)
      arr[j][i] += arr[j - 1][i] + arr[j][i - 1] - arr[j - 1][i - 1];
  cin >> I;
  for (int j = 1; j <= I; j++) cin >> instr[j].first >> instr[j].second;
  for (int j = 1; j <= let; j++) {
    if (check(j)) sol.push_back(symb[j]);
  }
  sort(sol.begin(), sol.end());
  if (sol.size() == 0)
    puts("no solution");
  else
    for (int j = 0; j < sol.size(); j++) putchar(sol[j]);
}
