#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
int poss[26][2];
char s[1000 + 1];
int table[maxn][maxn];
int h, w;
inline int norm(int x) { return x < 0 ? -1 : x > 0; }
int main() {
  int k;
  while (scanf("%d%d%d", &h, &w, &k) >= 1) {
    memset(poss, -1, sizeof(poss));
    for (int i = 0; i < h; i++) {
      scanf("%s", s);
      for (int j = 0; j < w; j++) {
        if ('a' <= s[j] && s[j] <= 'z') {
          poss[s[j] - 'a'][0] = i, poss[s[j] - 'a'][1] = j;
          s[j] = '1';
        }
        if ('1' <= s[j] && s[j] <= '9') {
          table[i][j] = s[j] - '0';
        } else
          table[i][j] = -1;
      }
    }
    int y0, x0, y1, x1;
    scanf("%d%d%s%d%d", &y0, &x0, s, &y1, &x1);
    y0--, x0--, y1--, x1--;
    assert(0 <= y0 && y0 < h);
    assert(0 <= x0 && x0 < w);
    assert(0 <= y1 && y1 < h);
    assert(0 <= x1 && x1 < w);
    int len = strlen(s);
    int y = y0, x = x0;
    for (int i = 0; i <= len && k > 0; i++) {
      int ny = -1, nx = -1;
      if (i < len)
        ny = poss[s[i] - 'a'][0], nx = poss[s[i] - 'a'][1];
      else
        ny = y1, nx = x1;
      if (!(ny >= 0 && ny < h && nx >= 0 && nx < w)) {
        assert(poss[s[i] - 'a'][0] == -1);
        assert('a' <= s[i] && s[i] <= 'z');
        assert(i < len);
        return 0;
      }
      while (y != ny || x != nx) {
        assert(y >= 0 && y < h && x >= 0 && x < w);
        int dy = norm(ny - y), dx = norm(nx - x);
        k -= table[y][x];
        if (k < 0) break;
        y += dy, x += dx;
      }
      if (k < 0) break;
      assert(y == ny && x == nx);
    }
    printf("%d %d\n", y + 1, x + 1);
    break;
  }
  return 0;
}
