#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k, t = -1, dostx[26], dosty[26], sum[1000][1000];
  bool map[1000][1000];
  char c, d[26];
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      cin >> c;
      switch (c) {
        case '#':
          map[i][j] = 1;
          break;
        case '.':
          map[i][j] = 0;
          break;
        default:
          t++;
          d[t] = c;
          dostx[t] = j;
          dosty[t] = i;
          map[i][j] = 0;
      }
    }
  sum[0][0] = 1;
  for (int j = 1; j < m; j++) sum[0][j] = 1 + j;
  for (int i = 1; i < n; i++) {
    sum[i][0] = i + 1;
    for (int j = 1; j < m; j++)
      sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] + map[i][j];
  }
  cin >> k;
  for (int i = 0; i < k; i++) {
    int l;
    cin >> c >> l;
    for (int j = 0; j <= t; j++) {
      bool mor = 0;
      int *x, *y;
      x = &dostx[j];
      y = &dosty[j];
      switch (c) {
        case 'N':
          if (*y >= l)
            if (sum[*y][*x] - sum[*y][*x - 1] - sum[*y - l - 1][*x] +
                    sum[*y - l - 1][*x - 1] ==
                0)
              *y -= l;
            else
              mor = 1;
          else
            mor = 1;
          break;
        case 'W':
          if (*x >= l)
            if (sum[*y][*x] - sum[*y][*x - l - 1] - sum[*y - 1][*x] +
                    sum[*y - 1][*x - l - 1] ==
                0)
              *x -= l;
            else
              mor = 1;
          else
            mor = 1;
          break;
        case 'S':
          if (*y + l < n)
            if (sum[*y + l][*x] - sum[*y + l][*x - 1] - sum[*y - 1][*x] +
                    sum[*y - 1][*x - 1] ==
                0)
              *y += l;
            else
              mor = 1;
          else
            mor = 1;
          break;
        case 'E':
          if (*x + l < m)
            if (sum[*y][*x + l] - sum[*y][*x - 1] - sum[*y - 1][*x + l] +
                    sum[*y - 1][*x - 1] ==
                0)
              *x += l;
            else
              mor = 1;
          else
            mor = 1;
          break;
      }
      if (mor) {
        dosty[j] = dosty[t];
        dostx[j] = dostx[t];
        d[j] = d[t];
        t--;
        j--;
      }
    }
  }
  if (t == -1)
    cout << "no solution";
  else {
    for (int i = 0; i <= t - 1; i++)
      for (int j = i + 1; j <= t; j++)
        if (d[i] > d[j]) {
          c = d[j];
          d[j] = d[i];
          d[i] = c;
        }
    for (int i = 0; i <= t; i++) cout << d[i];
  }
}
