#include <bits/stdc++.h>
using namespace std;
char A[107][107];
char P[1007];
int R[256], C[256];
int main() {
  int m, n, k;
  scanf("%d%d%d", &m, &n, &k);
  for (int i = 0; i < (int)(m); ++i) scanf("%s", A[i]);
  int rs, cs, re, ce;
  scanf("%d%d%s%d%d", &rs, &cs, P, &re, &ce);
  --rs, --cs, --re, --ce;
  for (int i = 0; i < (int)(m); ++i)
    for (int j = 0; j < (int)(n); ++j)
      if ('a' <= A[i][j] && A[i][j] <= 'z') {
        R[A[i][j]] = i;
        C[A[i][j]] = j;
        A[i][j] = '1';
      }
  int t = 0, r = rs, c = cs;
  for (int i = 0; P[i]; ++i) {
    while (r != R[P[i]] || c != C[P[i]]) {
      int dr = R[P[i]] - r;
      int dc = C[P[i]] - c;
      if (dr) dr /= abs(dr);
      if (dc) dc /= abs(dc);
      assert(dr * dc == 0);
      t += A[r][c] - '0';
      if (t > k) {
        printf("%d %d\n", r + 1, c + 1);
        return 0;
      }
      r += dr;
      c += dc;
    }
  }
  while (r != re || c != ce) {
    int dr = re - r;
    int dc = ce - c;
    if (dr) dr /= abs(dr);
    if (dc) dc /= abs(dc);
    assert(dr * dc == 0);
    t += A[r][c] - '0';
    if (t > k) {
      printf("%d %d\n", r + 1, c + 1);
      return 0;
    }
    r += dr;
    c += dc;
  }
  printf("%d %d\n", r + 1, c + 1);
}
