#include <bits/stdc++.h>
int m, n, k, R[27], C[27], r, c, y, x;
char a[101][102], s[1001];
int main() {
  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, R + 26, C + 26);
  for (int i = 0; s[i] || s[i - 1] != (s[i] = 'a' + 26); i++) {
    r = R[s[i] - 'a'];
    c = C[s[i] - 'a'];
    while (y != r || x != c) {
      k -= a[y][x] - '0';
      if (k < 0) goto end;
      y += (y < r) - (y > r);
      x += (x < c) - (x > c);
    }
  }
end:
  printf("%d %d\n", y, x);
}
