#include <bits/stdc++.h>
using namespace std;
template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
template <class L, class R, class M>
ostream& operator<<(ostream& os, tuple<L, R, M> P) {
  return os << "(" << get<0>(P) << "," << get<1>(P) << "," << get<2>(P) << ")";
}
template <class T>
ostream& operator<<(ostream& os, vector<T> V) {
  os << "{ ";
  for (auto v : V) os << v << " ";
  return os << "}";
}
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const long long maxn = (long long)1e6 + 6;
const long double EPS = 1e-9;
const long long INF = (long long)1e18 + 18;
const long long mod = (long long)1e9 + 7;
long long n, m, k;
char grid[1010][1010];
long long row_cnt[1010][1010], col_cnt[1010][1010];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  string s;
  vector<tuple<char, long long, long long>> a;
  vector<pair<char, long long>> inst;
  for (long long i = 0; i < n; i++) {
    cin >> s;
    for (long long j = 0; j < m; j++) {
      grid[i][j] = s[j];
      if (s[j] >= 'A' && s[j] <= 'Z') {
        a.emplace_back(s[j], i, j);
      }
      if (s[j] == '#') row_cnt[i][j]++, col_cnt[i][j]++;
    }
  }
  for (long long i = 0; i < n; i++)
    for (long long j = 1; j < m; j++) row_cnt[i][j] += row_cnt[i][j - 1];
  for (long long i = 0; i < m; i++)
    for (long long j = 1; j < n; j++) col_cnt[j][i] += col_cnt[j - 1][i];
  cin >> k;
  for (long long i = 0; i < k; i++) {
    char dir;
    cin >> dir;
    long long times;
    cin >> times;
    inst.emplace_back(dir, times);
  }
  vector<char> ans;
  for (auto [c, i, j] : a) {
    long long x = i, y = j;
    bool good = true;
    for (auto [dir, times] : inst) {
      bool horizontal = true;
      long long new_pos = -1;
      if (dir == 'N') new_pos = x - times, horizontal = false;
      if (dir == 'S') new_pos = x + times, horizontal = false;
      if (dir == 'E') new_pos = y + times;
      if (dir == 'W') new_pos = y - times;
      if (horizontal) {
        if (new_pos < 0 || new_pos >= m) {
          good = false;
          break;
        }
        long long from = y, to = new_pos, row = x;
        if (from > to) swap(from, to);
        long long bad_cells = row_cnt[row][to];
        if (from > 0) bad_cells -= row_cnt[row][from - 1];
        if (bad_cells > 0) {
          good = false;
          break;
        } else {
          y = new_pos;
        }
      } else {
        if (new_pos < 0 || new_pos >= n) {
          good = false;
          break;
        }
        long long from = x, to = new_pos, col = y;
        if (from > to) swap(from, to);
        long long bad_cells = col_cnt[to][col];
        if (from > 0) bad_cells -= col_cnt[from - 1][col];
        if (bad_cells > 0) {
          good = false;
          break;
        } else {
          x = new_pos;
        }
      }
    }
    if (good) ans.push_back(c);
  }
  if (ans.empty()) {
    cout << "no solution" << '\n';
    return 0;
  }
  sort(ans.begin(), ans.end());
  for (char c : ans) {
    cout << c;
  }
  cout << '\n';
  return 0;
}
