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 JAVA):

Solution:
import static java.lang.Math.*;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.exit;
import static java.lang.System.arraycopy;
import static java.util.Arrays.sort;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.fill;
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) throws IOException {
		try {
			if (new File("input.txt").exists())
				System.setIn(new FileInputStream("input.txt"));
		} catch (SecurityException e) {
		}
		new Thread(null, new Runnable() {
			public void run() {
				try {
					new Main().run();
				} catch (Throwable e) {
					e.printStackTrace();
					exit(999);
				}
			}
		}, "1", 1 << 23).start();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");

	int n, m;
	int k;
	int map[][];
	boolean ex[] = new boolean[26];
	int exc = 0;
	int si,sj,ei,ej;

	int stp[] = new int[3000];
	String ans = null;
	boolean ANS = false;
	
	Q qu = new Q(3000);
	
	boolean used[][];
	int pi[][];
	int pj[][];
	P dop[];
	
	int dx[] = {0, 0, 1, -1};
	int dy[] = {1, -1, 0, 0};
	void solve(int mask){
//		for(int i = 0; i < 10; i++)
//			System.err.print( ((mask & (1 << i)) == 0) ? 0 : 1);
//		out.println();
		
		for(boolean u[] : used)
			fill(u, false);
		for(int mm[] : pi)
			fill(mm, -1);
		for(int mm[] : pj)
			fill(mm, -1);
		fill(dop, null);
		qu.clear();
		qu.push(si, sj, -1, -1);
		used[si][sj] = true;
		while(!qu.isEmpty()){
			if(pi[ei][ej] != -1)
				break;
			int cdop = qu.getSize();
			for(int i = 0; i < cdop; i++)
				dop[i] = qu.pop();

			sort(dop, 0, cdop);
//			System.err.println("-------------------------");
//			System.err.println(Arrays.toString(dop));
			int pp = 0;
			int prev = 0;
			
			int np[] = new int[cdop];
			for(int i = 0; i < cdop; i++){
				if(!dop[i].eq(dop[pp])){
					prev++;
					pp = i;
				}
				np[i] = prev;
			}
			for(int i = 0; i < cdop; i++)
				dop[i].pr = np[i];
//			System.err.println(Arrays.toString(dop));
			
			for(int i = 0; i < cdop; i++)
				for(int k = 0; k < 4; k++){
					int ni = dop[i].i + dx[k];
					int nj = dop[i].j + dy[k];
					if(valid(ni, nj, mask)){
						used[ni][nj] = true;
						qu.push(ni, nj, map[ni][nj], dop[i].pr);
//						out.println(ni + " " + nj);
						pi[ni][nj] = dop[i].i;
						pj[ni][nj] = dop[i].j;
//						out.println(dop[i].i + " " + dop[i].j + " | " + ni + " " + nj);
					}
				}
		}
		if(pi[ei][ej] == -1)
			return;
		int p = 0;
		int i = pi[ei][ej];
		int j = pj[ei][ej];
		while(i != si || j != sj){
			int di = pi[i][j];
			int dj = pj[i][j];
			stp[p++] = map[i][j];
			i = di;
			j = dj;
		}
		char ss[] = new char[p];
		for(int c = 0; c < p; c++)
			ss[c] = (char)(stp[p - c - 1] + 'a');
		String S = new String(ss);
		ANS = true;
		if(ans == null || (ans.compareTo(S) > 0 && ans.length() == S.length()) || ans.length() > S.length()){
//			System.err.println("1)" + ans);
//			System.err.println("2)" + S);
//			if(ans != null)System.err.println(ans.compareTo(S));
			ans = S;
		}
	}
	boolean valid(int x, int y, int mask){
//		out.println("try" + x + " " +  y);
		if(x < 0 || y < 0 || x >= n || y >= m)
			return false;
		if( (mask & (1 << map[x][y])) == 0 && map[x][y] != 'T' - 'a')
			return false;
		if(used[x][y])
			return false;
		return true;
	}
	
	
	void gm(int prev, int c, int mask){
		if(c < k && c < exc){
			for(int i = prev + 1; i < 26; i++)
				if( (mask & (1 << i)) == 0 && ex[i] )
				gm(i, c + 1, mask | (1 << i));
			return;
		}
		solve(mask);
	}
	private void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
//		out = new PrintWriter("ans");

		n = nextInt();
		m = nextInt();
		k = nextInt();
		map = new int[n][m];
		used = new boolean[n][m];
		pi = new int[n][m];
		pj = new int[n][m];
		dop = new P[3000];
		
		for(int i = 0; i < n; i++){
			char[] s = nextToken().toCharArray();
			for(int j = 0; j < m; j++){
				map[i][j] = s[j] - 'a';
				if(s[j] == 'S'){
					si = i;
					sj = j;
					continue;
				}
				if(s[j] == 'T'){
					ei = i;
					ej = j;
					continue;
				}
				if(!ex[s[j] - 'a'])
					exc++;
				ex[s[j] - 'a'] = true;
			}
		}
	
		gm(-1, 0, 0);
		
		if(!ANS)
			out.println(-1);
		if(ANS)
			out.println(ans);
		in.close();
		out.close();
	}
	
	class Q{
		P m[];
		int h, t;
		int c;
		Q(int size){
			c = size;
			h = t = 0;
			m = new P[size];
			for(int i = 0; i < size; i++)
				m[i] = new P(0,0,0,0);
		}
		void push(int i, int j, int id, int pp){
			if(t == c)
				t = 0;
			m[t++].set(i, j, id, pp);
		}
		P pop(){
			if(h == c)
				h = 0;
			return m[h++];
		}
		int getSize(){
			return (t + c - h)% c;
		}
		boolean isEmpty(){
			return h == t;
		}
		void clear(){
			h = t = 0;
		}
	}
	class P implements Comparable<P>{
		int i, j, id, pr;
		P (int ii, int jj, int iidd, int pp){
			i = ii;
			j = jj;
			id = iidd;
			pr = pp;
		}
		void set (int ii, int jj, int iidd,int pp){
			i = ii;
			j = jj;
			id = iidd;
			pr = pp;
		}
		public int compareTo(P e){
			return pr == e.pr ? id - e.id : pr - e.pr;
		}
		public boolean eq(P e){
			return pr == e.pr && id == e.id;
		}
		public String toString(){
			return i + " " + j + "| "+ (char)(id + 'a') + " {" + pr + "} ";
		}
	}
	String nextToken() throws IOException {
		while (!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}
	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}
	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}
	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
	String nextLine() throws IOException {
		st = new StringTokenizer("");
		return in.readLine();
	}
	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			st = new StringTokenizer(s);
		}
		return false;
	}
}