#include <bits/stdc++.h>
char s[101][101];
int x[26], y[26];
char ss[1001];
int cal(int x1, int y1, int x2, int y2) {
  int i, j;
  if (x1 > x2) {
    i = x1;
    x1 = x2;
    x2 = i;
  }
  if (y1 > y2) {
    i = y1;
    y1 = y2;
    y2 = i;
  }
  int ret = 0;
  for (i = x1; i <= x2; i++)
    for (j = y1; j <= y2; j++)
      if (s[i][j] >= '0' && s[i][j] <= '9') ret = ret + s[i][j] - '0';
  return ret;
}
void gao(int k, int x1, int y1, int x2, int y2) {
  int i, j;
  if (x1 == x2) {
    if (y1 < y2)
      j = 1;
    else
      j = -1;
    for (i = y1; i != y2; i = i + j) {
      if (s[x1][i] >= 'a' && s[x1][i] <= 'z')
        k--;
      else
        k = k - (s[x1][i] - '0');
      if (k < 0) {
        printf("%d %d\n", x1 + 1, i + 1);
        return;
      }
    }
  } else {
    if (x1 < x2)
      j = 1;
    else
      j = -1;
    for (i = x1; i != x2; i = i + j) {
      if (s[i][y1] >= 'a' && s[i][y1] <= 'z')
        k--;
      else
        k = k - (s[i][y1] - '0');
      if (k < 0) {
        printf("%d %d\n", i + 1, y1 + 1);
        return;
      }
    }
  }
}
int main() {
  int m, n, k;
  int i, j;
  scanf("%d%d%d", &n, &m, &k);
  for (i = 0; i < n; i++) scanf("%s", s[i]);
  memset(x, -1, sizeof(x));
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++)
      if (s[i][j] >= 'a' && s[i][j] <= 'z') {
        x[s[i][j] - 'a'] = i;
        y[s[i][j] - 'a'] = j;
      }
  int sx, sy, ex, ey;
  scanf("%d%d", &sx, &sy);
  sx--;
  sy--;
  scanf("%s", ss);
  scanf("%d%d", &ex, &ey);
  ex--;
  ey--;
  int l = strlen(ss);
  int rr = cal(sx, sy, x[ss[0] - 'a'], y[ss[0] - 'a']);
  if (rr > k)
    gao(k, sx, sy, x[ss[0] - 'a'], y[ss[0] - 'a']);
  else {
    k = k - rr;
    for (i = 0; i < l - 1; i++) {
      rr = cal(x[ss[i] - 'a'], y[ss[i] - 'a'], x[ss[i + 1] - 'a'],
               y[ss[i + 1] - 'a']) +
           1;
      if (rr > k) {
        gao(k, x[ss[i] - 'a'], y[ss[i] - 'a'], x[ss[i + 1] - 'a'],
            y[ss[i + 1] - 'a']);
        break;
      } else
        k = k - rr;
    }
    if (i == l - 1) {
      rr = cal(x[ss[i] - 'a'], y[ss[i] - 'a'], ex, ey) + 1 - (s[ex][ey] - '0');
      if (rr > k)
        gao(k, x[ss[i] - 'a'], y[ss[i] - 'a'], ex, ey);
      else
        printf("%d %d\n", ex + 1, ey + 1);
    }
  }
  return 0;
}
