#include <bits/stdc++.h>
using namespace std;
char a[105][105], s[30];
int r2[30], c2[30];
int main() {
  int m, n, k, i, j, l, r1, c1;
  scanf("%d%d%d", &m, &n, &k);
  for (i = 1; i <= m; i++) {
    scanf(" %s", a[i] + 1);
    for (j = 1; j <= n; j++) {
      if (a[i][j] >= 'a' && a[i][j] <= 'z') {
        r2[a[i][j] - 'a'] = i;
        c2[a[i][j] - 'a'] = j;
        a[i][j] = 1;
      } else
        a[i][j] -= 48;
    }
  }
  scanf("%d%d %s%d%d", &r1, &c1, s, &r2[26], &c2[26]);
  l = strlen(s);
  for (i = 0; i < l; i++) s[i] -= 'a';
  s[l] = 26;
  for (i = 0; k > 0 && i <= l; i++) {
    while ((r1 != r2[s[i]] || c1 != c2[s[i]]) && k >= a[r1][c1]) {
      k -= a[r1][c1];
      if (r1 < r2[s[i]])
        r1++;
      else if (r1 > r2[s[i]])
        r1--;
      if (c1 < c2[s[i]])
        c1++;
      else if (c1 > c2[s[i]])
        c1--;
    }
  }
  printf("%d %d\n", r1, c1);
  return 0;
}
