#include <bits/stdc++.h>
using namespace std;
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, -1, 1};
char buf[100100];
int main() {
  int n, m;
  cin >> n >> m;
  vector<string> s;
  for (int i = (0); i < (n); ++i) {
    scanf("%s", buf);
    s.push_back(buf);
  }
  int k;
  cin >> k;
  vector<int> D(k);
  vector<int> L(k);
  for (int i = (0); i < (k); ++i) {
    string q;
    cin >> q >> L[i];
    char T[4] = {'N', 'S', 'W', 'E'};
    for (int j = (0); j < (4); ++j) {
      if (q[0] == T[j]) D[i] = j;
    }
  }
  string ans = "";
  vector<vector<int> > up(n);
  for (int i = (0); i < (n); ++i) up[i].resize(m, 0);
  vector<vector<int> > down = up;
  vector<vector<int> > left = up;
  vector<vector<int> > right = up;
  for (int i = (0); i < (n); ++i) {
    for (int j = (0); j < (m); ++j) {
      if (s[i][j] == '#')
        up[i][j] = 0;
      else {
        if (i == 0)
          up[i][j] = 0;
        else if (s[i - 1][j] == '#')
          up[i][j] = 0;
        else
          up[i][j] = up[i - 1][j] + 1;
      }
      if (s[i][j] == '#')
        left[i][j] = 0;
      else {
        if (j == 0)
          left[i][j] = 0;
        else if (s[i][j - 1] == '#')
          left[i][j] = 0;
        else
          left[i][j] = left[i][j - 1] + 1;
      }
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int j = m - 1; j >= 0; j--) {
      if (s[i][j] == '#')
        down[i][j] = 0;
      else {
        if (i == n - 1)
          down[i][j] = 0;
        else if (s[i + 1][j] == '#')
          down[i][j] = 0;
        else
          down[i][j] = down[i + 1][j] + 1;
      }
      if (s[i][j] == '#')
        right[i][j] = 0;
      else {
        if (j == m - 1)
          right[i][j] = 0;
        else if (s[i][j + 1] == '#')
          right[i][j] = 0;
        else
          right[i][j] = right[i][j + 1] + 1;
      }
    }
  }
  for (int i = (0); i < (n); ++i) {
    for (int j = (0); j < (m); ++j) {
      if (s[i][j] != '.' && s[i][j] != '#') {
        int x = i, y = j;
        bool is = true;
        for (int z = (0); z < (k); ++z) {
          if (D[z] == 0) {
            if (up[x][y] >= L[z])
              x -= L[z];
            else
              is = false;
          }
          if (D[z] == 1) {
            if (down[x][y] >= L[z])
              x += L[z];
            else
              is = false;
          }
          if (D[z] == 2) {
            if (left[x][y] >= L[z])
              y -= L[z];
            else
              is = false;
          }
          if (D[z] == 3) {
            if (right[x][y] >= L[z])
              y += L[z];
            else
              is = false;
          }
        }
        if (is) ans.push_back(s[i][j]);
      }
    }
  }
  sort((ans).begin(), (ans).end());
  if (int((ans).size()) == 0)
    cout << "no solution\n";
  else
    cout << ans << endl;
  return 0;
}
