#include <bits/stdc++.h>
using namespace std;
int x[35], y[35], n, m, k, p, q, si;
char s[1005], a[105][105];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%s", a[i] + 1);
    for (int j = 1; j <= m; j++) {
      if ((a[i][j] >= 'a') && (a[i][j] <= 'z')) {
        x[a[i][j] - 'a'] = i;
        y[a[i][j] - 'a'] = j;
        a[i][j] = 1;
      } else {
        a[i][j] -= '0';
      }
    }
  }
  scanf("%d%d%s%d%d", &p, &q, s + 1, &x[26], &y[26]);
  si = strlen(s + 1) + 1;
  s[si] = 26;
  for (int i = 1; i < si; i++) s[i] -= 'a';
  for (int i = 1; i <= si && k > 0; i++) {
    while ((p != x[s[i]]) || (q != y[s[i]])) {
      k -= a[p][q];
      if (k < 0) break;
      if (p > x[s[i]]) --p;
      if (p < x[s[i]]) ++p;
      if (q > y[s[i]]) --q;
      if (q < y[s[i]]) ++q;
    }
  }
  printf("%d %d", p, q);
  return 0;
}
