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;
const int INF = (int)1e9;
const long double EPS = 1e-9;
const long double PI = 3.1415926535897932384626433832795;
const int N = 100;
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};
int n, m, k;
char a[N][N];
inline int sign(int a) {
  if (a == 0) return 0;
  return ((a < 0) ? (-1) : (1));
}
int szchrs;
char chrs[N * N];
pair<int, int> st, fn, sc;
char tp[N];
bool isGood[300];
pair<int, int> bs, bt;
inline bool good(const pair<int, int>& a) {
  return bs.first <= a.first && a.first < bt.first && bs.second <= a.second &&
         a.second < bt.second;
}
int cu;
int used[N][N];
int lvl[N][N], lvlT[N][N];
void updateAns(string& ans) {
  string res = "";
  vector<pair<int, int> > cur;
  cur.push_back(sc);
  res.push_back(tp[0]);
  cu++;
  used[sc.first][sc.second] = cu;
  lvl[sc.first][sc.second] = 0;
  queue<pair<int, int> > q;
  q.push(sc);
  while (!q.empty()) {
    pair<int, int> v = q.front();
    q.pop();
    for (int i = 0; i < int(4); ++i) {
      pair<int, int> u(v.first + dx[i], v.second + dy[i]);
      if (good(u) && isGood[a[u.first][u.second]] &&
          used[u.first][u.second] < cu) {
        used[u.first][u.second] = cu;
        lvl[u.first][u.second] = lvl[v.first][v.second] + 1;
        q.push(u);
      }
    }
  }
  if (used[fn.first][fn.second] < cu) return;
  cu++;
  used[fn.first][fn.second] = cu;
  lvlT[fn.first][fn.second] = 0;
  q.push(fn);
  while (!q.empty()) {
    pair<int, int> v = q.front();
    q.pop();
    for (int i = 0; i < int(4); ++i) {
      pair<int, int> u(v.first + dx[i], v.second + dy[i]);
      if (good(u) && isGood[a[u.first][u.second]] &&
          used[u.first][u.second] < cu) {
        used[u.first][u.second] = cu;
        lvlT[u.first][u.second] = lvlT[v.first][v.second] + 1;
        q.push(u);
      }
    }
  }
  while (!cur.empty()) {
    char mn = 'z' + 1;
    for (int i = 0; i < int(int((cur).size())); ++i)
      for (int j = 0; j < int(4); ++j) {
        pair<int, int> nx(cur[i].first + dx[j], cur[i].second + dy[j]);
        if (good(nx) && used[nx.first][nx.second] == cu &&
            lvl[nx.first][nx.second] + lvlT[nx.first][nx.second] ==
                lvl[fn.first][fn.second] &&
            lvl[nx.first][nx.second] == lvl[cur[i].first][cur[i].second] + 1) {
          mn = min(mn, a[nx.first][nx.second]);
        }
      }
    if (mn == 'z' + 1) throw;
    if (mn == 'T') {
      break;
    } else {
      res.push_back(mn);
      vector<pair<int, int> > c2;
      for (int i = 0; i < int(int((cur).size())); ++i)
        for (int j = 0; j < int(4); ++j) {
          pair<int, int> nx(cur[i].first + dx[j], cur[i].second + dy[j]);
          if (good(nx) && a[nx.first][nx.second] == mn &&
              used[nx.first][nx.second] == cu &&
              lvl[nx.first][nx.second] ==
                  lvl[cur[i].first][cur[i].second] + 1) {
            c2.push_back(nx);
          }
        }
      sort((c2).begin(), (c2).end());
      c2.erase(unique((c2).begin(), (c2).end()), c2.end());
      cur = c2;
    }
  }
  if (ans == "-1" || (int((ans).size()) > int((res).size()) ||
                      (int((ans).size()) == int((res).size()) && ans > res)))
    ans = res;
}
void solve(int cnt, int idx, string& ans) {
  if (cnt == k) {
    for (int j = 0; j < int(k); ++j) isGood[tp[j]] = true;
    updateAns(ans);
    for (int j = 0; j < int(k); ++j) isGood[tp[j]] = false;
    return;
  }
  for (int i = idx; i < szchrs; ++i) {
    tp[cnt] = chrs[i];
    solve(cnt + 1, i, ans);
  }
}
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < int(n); ++i)
    for (int j = 0; j < int(m); ++j) {
      scanf(" %c", &a[i][j]);
      if (a[i][j] == 'S') {
        st = pair<int, int>(i, j);
        continue;
      }
      if (a[i][j] == 'T') {
        fn = pair<int, int>(i, j);
        continue;
      }
      chrs[szchrs++] = a[i][j];
    }
  sort(chrs, chrs + szchrs);
  szchrs = unique(chrs, chrs + szchrs) - chrs;
  bs.first = 0;
  bs.second = 0;
  bt.first = n;
  bt.second = m;
  string ans = "-1";
  isGood['S'] = true;
  isGood['T'] = true;
  for (int i = 0; i < int(4); ++i) {
    sc = pair<int, int>(st.first + dx[i], st.second + dy[i]);
    if (!good(sc)) continue;
    tp[0] = a[sc.first][sc.second];
    if (tp[0] == 'T') {
      return 0;
    }
    solve(1, 0, ans);
  }
  cout << ans << endl;
  return 0;
}