#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5, K = 1e5 + 5;
vector<int> row[N], col[N];
char dir[K];
int steps[K];
int n, m, k;
vector<int> getRBound(int i, int j) {
  auto it = upper_bound(col[j].begin(), col[j].end(), i);
  auto it2 = it;
  it2--;
  return {(*it2), (*it)};
}
vector<int> getCBound(int i, int j) {
  auto it = upper_bound(row[i].begin(), row[i].end(), j);
  auto it2 = it;
  it2--;
  return {(*it2), (*it)};
}
bool check(int i, int j, int k_idx) {
  if (k_idx == k) return true;
  bool fail = true;
  switch (dir[k_idx]) {
    case 'N': {
      vector<int> res = getRBound(i, j);
      i = i - steps[k_idx];
      if (res[0] >= i) fail = false;
      break;
    }
    case 'S': {
      vector<int> res = getRBound(i, j);
      i = i + steps[k_idx];
      if (res[1] <= i) fail = false;
      break;
    }
    case 'W': {
      vector<int> res = getCBound(i, j);
      j = j - steps[k_idx];
      if (res[0] >= j) fail = false;
      break;
    }
    case 'E': {
      vector<int> res = getCBound(i, j);
      j = j + steps[k_idx];
      if (res[1] <= j) fail = false;
      break;
    }
  }
  return fail && check(i, j, k_idx + 1);
}
void solve() {
  cin >> n >> m;
  string s[n];
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    for (int j = 0; j < m; j++) {
      if (s[i][j] == '#') row[i].push_back(j), col[j].push_back(i);
    }
  }
  cin >> k;
  for (int i = 0; i < k; i++) cin >> dir[i] >> steps[i];
  string ans;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (isalpha(s[i][j]) && check(i, j, 0)) ans += s[i][j];
    }
  }
  sort(ans.begin(), ans.end());
  if (ans.empty()) ans = "no solution";
  cout << ans << "\n";
}
int main() { solve(); }
