#include <bits/stdc++.h>
using namespace std;
int N, M, K;
int C[110][110], PR[110][110], PC[110][110];
int X[26], Y[26];
int Dist(int x, int y, int xp, int yp) {
  if (x == xp)
    if (y <= yp)
      return PR[x][yp - 1] - PR[x][y - 1];
    else
      return PR[x][y] - PR[x][yp];
  else if (x <= xp)
    return PC[xp - 1][y] - PC[x - 1][y];
  else
    return PC[x][y] - PC[xp][y];
}
void Route(int x, int y, int xp, int yp) {
  if (K >= Dist(x, y, xp, yp)) {
    K -= Dist(x, y, xp, yp);
    return;
  }
  int dx = (x == xp) ? 0 : ((x < xp) ? 1 : -1);
  int dy = (y == yp) ? 0 : ((y < yp) ? 1 : -1);
  while (K >= C[x][y]) {
    K -= C[x][y];
    x += dx;
    y += dy;
  }
  printf("%d %d\n", x, y);
  exit(0);
}
char S[100010];
int sx, sy, ex, ey;
int main() {
  scanf("%d%d%d", &N, &M, &K);
  int i, j;
  for (i = 0; i <= 25; i++) X[i] = Y[i] = 0;
  for (i = 1; i <= N; i++) {
    char ch[110];
    scanf("%s", ch + 1);
    for (j = 1; j <= M; j++)
      if (ch[j] == '#')
        C[i][j] = 0;
      else if ((ch[j] >= '0') && (ch[j] <= '9'))
        C[i][j] = ch[j] - '0';
      else {
        C[i][j] = 1;
        X[ch[j] - 'a'] = i;
        Y[ch[j] - 'a'] = j;
      }
  }
  for (i = 1; i <= N; i++) {
    PR[i][0] = 0;
    for (j = 1; j <= M; j++) PR[i][j] = PR[i][j - 1] + C[i][j];
  }
  for (i = 1; i <= M; i++) {
    PC[0][i] = 0;
    for (j = 1; j <= N; j++) PC[j][i] = PC[j - 1][i] + C[j][i];
  }
  scanf("%d%d%s%d%d", &sx, &sy, S + 1, &ex, &ey);
  Route(sx, sy, X[S[1] - 'a'], Y[S[1] - 'a']);
  int s0 = strlen(S + 1);
  for (i = 2; i <= s0; i++)
    Route(X[S[i - 1] - 'a'], Y[S[i - 1] - 'a'], X[S[i] - 'a'], Y[S[i] - 'a']);
  Route(X[S[s0] - 'a'], Y[S[s0] - 'a'], ex, ey);
  printf("%d %d\n", ex, ey);
}
