#include <bits/stdc++.h>
using namespace std;
const bool DEBUG = true;
const int INF = 2e9;
const long long LINF = 2e18;
int d[1111][1111], u[1111][1111], l[1111][1111], r[1111][1111];
char a[1111][1111];
int k;
char key[111111];
int s[111111];
int n, m;
bool test(int x, int y) {
  for (int i = 1; i <= k; i++) {
    if (key[i] == 'N') {
      if (x - s[i] > u[x][y])
        x -= s[i];
      else
        return false;
      continue;
    }
    if (key[i] == 'S') {
      if (x + s[i] < d[x][y])
        x += s[i];
      else
        return false;
      continue;
    }
    if (key[i] == 'E') {
      if (y + s[i] < r[x][y])
        y += s[i];
      else
        return false;
      continue;
    }
    if (key[i] == 'W') {
      if (y - s[i] > l[x][y])
        y -= s[i];
      else
        return false;
      continue;
    }
  }
  return true;
}
void print() {
  cout << "L" << endl;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cout << l[i][j] << ' ';
    }
    cout << endl;
  }
  cout << "R" << endl;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cout << r[i][j] << ' ';
    }
    cout << endl;
  }
  cout << "U" << endl;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cout << u[i][j] << ' ';
    }
    cout << endl;
  }
  cout << "D" << endl;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cout << d[i][j] << ' ';
    }
    cout << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  cin >> k;
  for (int i = 1; i <= k; i++) cin >> key[i] >> s[i];
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (a[i][j] == '#')
        l[i][j] = j, u[i][j] = i;
      else
        l[i][j] = l[i][j - 1], u[i][j] = u[i - 1][j];
    }
  }
  for (int i = n; i >= 1; i--) {
    for (int j = m; j >= 1; j--) {
      if (a[i][j] == '#')
        r[i][j] = j, d[i][j] = i;
      else
        r[i][j] = r[i][j + 1], d[i][j] = d[i + 1][j];
    }
  }
  vector<char> answer;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (isalpha(int(a[i][j]))) {
        if (test(i, j)) {
          answer.push_back(a[i][j]);
        }
      }
    }
  }
  if (answer.empty()) {
    cout << "no solution";
  } else {
    sort(answer.begin(), answer.end());
    for (auto c : answer) {
      cout << c;
    }
  }
  return 0;
}
