#include <bits/stdc++.h>
using namespace std;
const int M = 1000;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  int cnt = 1;
  bool flag = false;
  vector<pair<int, int>> start;
  vector<vector<char>> a(M, vector<char>(M));
  vector<vector<pair<int, int>>> foo(M, vector<pair<int, int>>(M));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
      if (a[i][j] == '#')
        cnt += flag;
      else
        foo[i][j].first = cnt;
      flag = a[i][j] != '#';
      if (isalpha(a[i][j])) start.emplace_back(i, j);
    }
  }
  flag = false;
  for (int j = 0; j < m; j++) {
    for (int i = 0; i < n; i++) {
      if (a[i][j] == '#')
        cnt += flag;
      else
        foo[i][j].second = cnt;
      flag = a[i][j] != '#';
    }
  }
  int q;
  char c;
  cin >> q;
  vector<tuple<int, int, int>> ins;
  for (int i = 0, d; i < q; i++) {
    cin >> c >> d;
    int x = 0, y = 0;
    if (c == 'N' || c == 'S') x = (c == 'N' ? -1 : 1);
    if (c == 'E' || c == 'W') y = (c == 'W' ? -1 : 1);
    ins.emplace_back(x, y, d);
  }
  auto in = [&](int x, int y, int px, int py) -> bool {
    flag = x >= 0 && y >= 0 && x < n && y < m && a[x][y] != '#';
    if (flag)
      flag &= foo[x][y].first == foo[px][py].first ||
              foo[x][y].second == foo[px][py].second;
    return flag;
  };
  auto apply = [&](int &x, int &y, tuple<int, int, int> &dir) -> bool {
    auto [dx, dy, step] = dir;
    int cx = x + dx * step;
    int cy = y + dy * step;
    if (in(cx, cy, x, y)) return (x = cx, y = cy), true;
    return false;
  };
  string ans;
  for (auto &[x, y] : start) {
    bool ok = true;
    ans += a[x][y];
    for (auto &t : ins) ok &= apply(x, y, t);
    if (!ok) ans.pop_back();
  }
  sort(ans.begin(), ans.end());
  cout << (ans == "" ? "no solution" : ans);
  return 0;
}
