#include <bits/stdc++.h>
using namespace std;
struct MAP {
  bool pass;
  int w, e, s, n;
};
MAP mm[1002][1002];
struct NODE {
  char w;
  int row, col;
};
vector<NODE> start;
NODE way[100000];
bool cmp(NODE a, NODE b) {
  if (a.w < b.w)
    return true;
  else
    return false;
}
int main() {
  int i, j, k, row, col, num;
  char in[1005];
  NODE tmp;
  while (scanf("%d %d", &row, &col) == 2) {
    start.clear();
    memset(mm, 0, sizeof(mm));
    for (i = 1; i <= row; ++i) {
      scanf("%s", in);
      for (j = 0; j < col; ++j) {
        if (in[j] == '.')
          mm[i][j + 1].pass = true;
        else if (in[j] != '#') {
          mm[i][j + 1].pass = true;
          tmp.w = in[j];
          tmp.row = i;
          tmp.col = j + 1;
          start.push_back(tmp);
        }
      }
    }
    sort(start.begin(), start.end(), cmp);
    scanf("%d", &num);
    for (i = 0; i < num; ++i) {
      getchar();
      scanf("%c %d", &way[i].w, &way[i].row);
    }
    for (i = 1; i <= row; ++i) {
      k = -1;
      for (j = 1; j <= col; ++j) {
        if (k == -1 && mm[i][j].pass) k = j;
        if (mm[i][j].pass)
          mm[i][j].w = k;
        else
          k = -1;
      }
    }
    for (i = 1; i <= row; ++i) {
      k = -1;
      for (j = col; j >= 1; --j) {
        if (k == -1 && mm[i][j].pass) k = j;
        if (mm[i][j].pass)
          mm[i][j].e = k;
        else
          k = -1;
      }
    }
    for (i = 1; i <= col; ++i) {
      k = -1;
      for (j = 1; j <= row; ++j) {
        if (k == -1 && mm[j][i].pass) k = j;
        if (mm[j][i].pass)
          mm[j][i].n = k;
        else
          k = -1;
      }
    }
    for (i = 1; i <= col; ++i) {
      k = -1;
      for (j = row; j >= 1; --j) {
        if (k == -1 && mm[j][i].pass) k = j;
        if (mm[j][i].pass)
          mm[j][i].s = k;
        else
          k = -1;
      }
    }
    for (i = 0, k = 0; i < start.size(); ++i) {
      row = start[i].row;
      col = start[i].col;
      for (j = 0; j < num; ++j) {
        if (way[j].w == 'E') {
          if (col + way[j].row <= mm[row][col].e)
            col += way[j].row;
          else
            break;
        } else if (way[j].w == 'W') {
          if (col - way[j].row >= mm[row][col].w)
            col -= way[j].row;
          else
            break;
        } else if (way[j].w == 'S') {
          if (row + way[j].row <= mm[row][col].s)
            row += way[j].row;
          else
            break;
        } else {
          if (row - way[j].row >= mm[row][col].n)
            row -= way[j].row;
          else
            break;
        }
      }
      if (j == num) {
        putchar(start[i].w);
        ++k;
      }
    }
    if (k)
      putchar('\n');
    else
      puts("no solution");
  }
  return 0;
}
