Problem: You already know that Valery's favorite sport is biathlon. Due to your help, he learned to shoot without missing, and his skills are unmatched at the shooting range. But now a smaller task is to be performed, he should learn to complete the path fastest.

The track's map is represented by a rectangle n × m in size divided into squares. Each square is marked with a lowercase Latin letter (which means the type of the plot), with the exception of the starting square (it is marked with a capital Latin letters S) and the terminating square (it is marked with a capital Latin letter T). The time of movement from one square to another is equal to 1 minute. The time of movement within the cell can be neglected. We can move from the cell only to side-adjacent ones, but it is forbidden to go beyond the map edges. Also the following restriction is imposed on the path: it is not allowed to visit more than k different types of squares (squares of one type can be visited an infinite number of times). Squares marked with S and T have no type, so they are not counted. But S must be visited exactly once — at the very beginning, and T must be visited exactly once — at the very end.

Your task is to find the path from the square S to the square T that takes minimum time. Among all shortest paths you should choose the lexicographically minimal one. When comparing paths you should lexicographically represent them as a sequence of characters, that is, of plot types.

Input

The first input line contains three integers n, m and k (1 ≤ n, m ≤ 50, n·m ≥ 2, 1 ≤ k ≤ 4). Then n lines contain the map. Each line has the length of exactly m characters and consists of lowercase Latin letters and characters S and T. It is guaranteed that the map contains exactly one character S and exactly one character T.

Pretest 12 is one of the maximal tests for this problem.

Output

If there is a path that satisfies the condition, print it as a sequence of letters — the plot types. Otherwise, print "-1" (without quotes). You shouldn't print the character S in the beginning and T in the end.

Note that this sequence may be empty. This case is present in pretests. You can just print nothing or print one "End of line"-character. Both will be accepted.

Examples

Input

5 3 2
Sba
ccc
aac
ccc
abT


Output

bcccc


Input

3 4 1
Sxyy
yxxx
yyyT


Output

xxxx


Input

1 3 3
TyS


Output

y


Input

1 4 1
SxyT


Output

-1

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T qmin(const T &a, const T &b) {
  return a < b ? a : b;
}
template <typename T>
inline T qmax(const T &a, const T &b) {
  return a > b ? a : b;
}
template <typename T>
inline void getmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <typename T>
inline void getmax(T &a, const T &b) {
  if (a < b) a = b;
}
inline void fileio(string s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
const int inf = 1e9 + 7;
const int N = 51, M = 2953;
const int go[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
char g[N][N];
int tp[N][N];
map<int, int> id;
int mask[M], cnt;
int dis[N][N][M];
bool vis[N][N][M], can[N][N][M];
int ans[N][N][M];
vector<pair<pair<int, int>, int> > to[N][N][M];
int n, m, k, sti, stj, edi, edj;
inline void bfs() {
  static queue<pair<pair<int, int>, int> > q;
  static int st, ed;
  dis[sti][stj][1] = 1;
  q.push(make_pair(make_pair(sti, stj), 1));
  while (!q.empty()) {
    pair<pair<int, int>, int> p = q.front();
    q.pop();
    int i = p.first.first, j = p.first.second, comb = mask[p.second];
    if (dis[i][j][p.second] == dis[edi][edj][1]) break;
    comb |= (~tp[i][j] ? 1 << tp[i][j] : 0);
    for (register int d = 0; d < (4); ++d) {
      int ni = i + go[d][0], nj = j + go[d][1];
      if (ni < 1 || ni > n || nj < 1 || nj > m || (ni == sti && nj == stj))
        continue;
      int ncomb = comb;
      if (~tp[ni][nj]) {
        ncomb &= ~(1 << tp[ni][nj]);
        if (__builtin_popcount(ncomb) >= k) continue;
      } else {
        ncomb = 0;
      }
      int cid = id[ncomb];
      if (dis[ni][nj][cid]) {
        if (dis[ni][nj][cid] == dis[i][j][p.second] + 1)
          to[i][j][p.second].push_back(make_pair(make_pair(ni, nj), cid));
        continue;
      }
      dis[ni][nj][cid] = dis[i][j][p.second] + 1;
      q.push(make_pair(make_pair(ni, nj), cid));
      to[i][j][p.second].push_back(make_pair(make_pair(ni, nj), cid));
    }
  }
}
inline bool cmp(const pair<pair<int, int>, int> &a,
                const pair<pair<int, int>, int> &b) {
  pair<int, int> p = a.first, q = b.first;
  if (g[p.first][p.second] != g[q.first][q.second])
    return g[p.first][p.second] < g[q.first][q.second];
  if (p.first == edi && p.second == edj) return false;
  return cmp(to[p.first][p.second][a.second][ans[p.first][p.second][a.second]],
             to[q.first][q.second][b.second][ans[q.first][q.second][b.second]]);
}
inline void dfs(int i, int j, int k) {
  if (vis[i][j][k]) return;
  vis[i][j][k] = true;
  if (i == edi && j == edj) {
    can[i][j][k] = true;
    return;
  }
  vector<pair<int, int> > nxt;
  for (register int d = 0; d < (to[i][j][k].size()); ++d) {
    pair<pair<int, int>, int> p = to[i][j][k][d];
    int ni = p.first.first, nj = p.first.second, nk = p.second;
    nxt.push_back(make_pair(tp[ni][nj], d));
  }
  sort(nxt.begin(), nxt.end());
  for (int id1 = 0, id2; id1 < nxt.size(); id1 = id2) {
    int bst = -1;
    for (id2 = id1; id2 < nxt.size() && nxt[id2].first == nxt[id1].first;
         ++id2) {
      pair<pair<int, int>, int> p = to[i][j][k][nxt[id2].second];
      dfs(p.first.first, p.first.second, p.second);
      if (can[p.first.first][p.first.second][p.second]) {
        if (bst == -1 || cmp(p, to[i][j][k][bst])) bst = nxt[id2].second;
      }
    }
    if (~bst) {
      can[i][j][k] = true;
      ans[i][j][k] = bst;
      return;
    }
  }
}
inline void getans(pair<pair<int, int>, int> a) {
  pair<int, int> p = a.first;
  if (p.first == edi && p.second == edj) return;
  if (p.first != sti || p.second != stj) putchar(g[p.first][p.second]);
  getans(to[p.first][p.second][a.second][ans[p.first][p.second][a.second]]);
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (register int i = (1); i <= (n); ++i) {
    scanf("%s", g[i] + 1);
    for (register int j = (1); j <= (m); ++j) {
      if (g[i][j] == 'S') {
        tp[i][j] = -1;
        sti = i, stj = j;
      } else if (g[i][j] == 'T') {
        tp[i][j] = -1;
        edi = i, edj = j;
      } else {
        tp[i][j] = g[i][j] - 'a';
      }
    }
  }
  id[0] = ++cnt;
  mask[cnt] = 0;
  for (register int i = (1); i <= (k - 1); ++i) {
    for (int comb = (1 << i) - 1, x, y; comb < (1 << 26);
         x = comb & -comb, y = comb + x, comb = ((comb & ~y) / x >> 1) | y) {
      id[comb] = ++cnt;
      mask[cnt] = comb;
    }
  }
  bfs();
  if (!dis[edi][edj][1]) return puts("-1"), 0;
  dfs(sti, stj, 1);
  getans(make_pair(make_pair(sti, stj), 1));
  puts("");
  return 0;
}