#include <bits/stdc++.h>
using namespace std;
vector<pair<char, int> > way;
vector<pair<int, int> > dost;
int n, m, k, sum[1005][1005];
char c[1005][1005];
vector<char> ans;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> c[i][j];
      if (c[i][j] != '#') sum[i][j]++;
      if (c[i][j] >= 'A' && c[i][j] <= 'Z') dost.push_back(make_pair(i, j));
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      sum[i][j] += sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];
    }
  }
  cin >> k;
  for (int i = 0; i < k; i++) {
    char d;
    int cnt;
    cin >> d >> cnt;
    way.push_back(make_pair(d, cnt));
  }
  for (int i = 0; i < dost.size(); i++) {
    int x = dost[i].first;
    int y = dost[i].second;
    bool ch = true;
    for (int j = 0; j < way.size(); j++) {
      if (way[j].first == 'N') {
        int x1 = x - way[j].second;
        int y1 = y;
        if (x1 >= 1 && (sum[x][y] - sum[x][y - 1] - sum[x1 - 1][y] +
                        sum[x1 - 1][y1 - 1]) == (way[j].second + 1)) {
          swap(x, x1);
          swap(y, y1);
        } else {
          ch = 0;
          break;
        }
      } else if (way[j].first == 'S') {
        int x1 = x + way[j].second;
        int y1 = y;
        if (x1 >= 1 && (sum[x1][y1] - sum[x1][y1 - 1] - sum[x - 1][y] +
                        sum[x - 1][y - 1]) == (way[j].second + 1)) {
          swap(x, x1);
          swap(y, y1);
        } else {
          ch = 0;
          break;
        }
      } else if (way[j].first == 'E') {
        int x1 = x;
        int y1 = y + way[j].second;
        if (x1 >= 1 && (sum[x1][y1] - sum[x][y - 1] - sum[x1 - 1][y1] +
                        sum[x - 1][y - 1]) == (way[j].second + 1)) {
          swap(x, x1);
          swap(y, y1);
        } else {
          ch = 0;
          break;
        }
      } else {
        int x1 = x;
        int y1 = y - way[j].second;
        if (x1 >= 1 && (sum[x][y] - sum[x1][y1 - 1] - sum[x - 1][y] +
                        sum[x1 - 1][y1 - 1]) == (way[j].second + 1)) {
          swap(x, x1);
          swap(y, y1);
        } else {
          ch = 0;
          break;
        }
      }
    }
    if (ch) ans.push_back(c[dost[i].first][dost[i].second]);
  }
  if (ans.empty()) {
    cout << "no solution";
    return 0;
  }
  sort(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i];
  }
  return 0;
}
