#include <bits/stdc++.h>
int nextInt() {
  int x;
  scanf("%d", &x);
  return x;
}
double nextDouble() {
  double x;
  scanf("%lf", &x);
  return x;
}
long long nextLong() {
  long long x;
  scanf("%I64d", &x);
  return x;
}
char nextChar() {
  char x;
  scanf("%c", &x);
  return x;
}
void newLine() { printf("\n"); }
long long powM(long long a, long long b, long long MOD) {
  long long x = 1, y = a;
  while (b > 0) {
    if (b % 2 == 1) {
      x = (x * y);
      if (x > MOD) x %= MOD;
    }
    y = (y * y);
    if (y > MOD) y %= MOD;
    b /= 2;
  }
  return x;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
int countSetBits(long long n) {
  int ans = 0;
  while (n != 0) {
    n -= (n & -n);
    ++ans;
  }
  return ans;
}
long long mod = 1000000007;
long long mod2 = 1000000009;
const int N = 1111;
const int M = 100100;
const int LOG = 21;
const int INF = 1e9;
const long double EPS = 1e-6;
const long double PI = 2 * acos(0);
using namespace std;
char g[N][N];
int row[N][N];
int col[N][N];
int type[M], val[M];
set<pair<char, pair<int, int> > > s;
int n, m;
bool move(int type, int val, int& r, int& c) {
  if (type == 1) {
    if (c + val >= m || c + val < 0) return false;
    int res = 0;
    if (val >= 0) {
      res += row[r][c + val];
      if (c > 0) res -= row[r][c - 1];
    } else {
      res += row[r][c];
      if (c + val > 0) res -= row[r][c + val - 1];
    }
    if (res > 0) return false;
    c = c + val;
    return true;
  } else {
    if (r + val >= n || r + val < 0) return false;
    int res = 0;
    if (val >= 0) {
      res += col[c][r + val];
      if (r > 0) res -= col[c][r - 1];
    } else {
      res += col[c][r];
      if (r + val > 0) res -= col[c][r + val - 1];
    }
    if (res > 0) return false;
    r = r + val;
    return true;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> g[i][j];
      if (g[i][j] == '#') {
        row[i][j] += 1;
        col[j][i] += 1;
      }
      if (g[i][j] != '#' && g[i][j] != '.') {
        s.insert(make_pair(g[i][j], make_pair(i, j)));
      }
    }
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m - 1; j++) row[i][j + 1] += row[i][j];
  for (int j = 0; j < m; j++)
    for (int i = 0; i < n - 1; i++) col[j][i + 1] += col[j][i];
  int k;
  cin >> k;
  for (int i = 0; i < k; i++) {
    char c;
    cin >> c >> val[i];
    if (c == 'N' || c == 'S')
      type[i] = 2;
    else
      type[i] = 1;
    if (c == 'N' || c == 'W') val[i] *= -1;
  }
  string sol = "";
  while (!s.empty()) {
    pair<char, pair<int, int> > p = *s.begin();
    s.erase(s.begin());
    int r = p.second.first;
    int c = p.second.second;
    bool add = true;
    for (int i = 0; i < k; i++) {
      if (!move(type[i], val[i], r, c)) {
        add = false;
        break;
      }
    }
    if (add) sol += p.first;
  }
  if (sol == "")
    puts("no solution");
  else
    cout << sol << endl;
  return 0;
}
