#include <bits/stdc++.h>
int m, n, k, r[26], c[26], re, ce, y, x;
char a[101][102], s[1001];
inline void go(int r, int c) {
  while (y != r || x != c) {
    k -= a[y][x] - '0';
    if (k < 0) exit(0);
    y += (y < r) - (y > r);
    x += (x < c) - (x > c);
  }
}
void f(void) { printf("%d %d\n", y, x); }
int main() {
  atexit(f);
  scanf("%d%d%d", &m, &n, &k);
  for (int i = 1; i <= m; i++) {
    scanf("%s", a[i] + 1);
    for (int j = 1; j <= n; j++)
      if (islower(a[i][j])) {
        r[a[i][j] - 'a'] = i;
        c[a[i][j] - 'a'] = j;
        a[i][j] = '1';
      }
  }
  scanf("%d%d%s%d%d", &y, &x, s, &re, &ce);
  for (int i = 0; s[i]; i++) go(r[s[i] - 'a'], c[s[i] - 'a']);
  go(re, ce);
  return 0;
}
