#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int n, k, r, c, sx, sy, ex, ey;
pair<int, int> junc[N];
char mp[N][N];
char s[1010];
inline int sign(int x) { return x < 0 ? -1 : x > 0; }
void init() {
  scanf("%d %d %d", &r, &c, &k);
  for (int i = 1; i <= r; ++i) scanf("%s", mp[i] + 1);
  for (int i = 1; i <= r; ++i)
    for (int j = 1; j <= c; ++j)
      if (mp[i][j] <= 'z' && mp[i][j] >= 'a')
        junc[mp[i][j] - 'a'] = make_pair(i, j), mp[i][j] = '1';
}
void go(int &sx, int &sy, int tx, int ty) {
  int dx = sign(tx - sx), dy = sign(ty - sy);
  while (sx != tx || sy != ty) {
    k -= mp[sx][sy] - '0';
    if (k < 0) {
      printf("%d %d\n", sx, sy);
      exit(0);
    }
    sx += dx;
    sy += dy;
  }
}
void solve() {
  scanf("%d %d %s %d %d`", &sx, &sy, s, &ex, &ey);
  for (int i = 0; s[i]; ++i)
    go(sx, sy, junc[s[i] - 'a'].first, junc[s[i] - 'a'].second);
  go(sx, sy, ex, ey);
  printf("%d %d\n", ex, ey);
}
int main() {
  init();
  solve();
  return 0;
}
