You have been given a N x M matrix containing lowercase English alphabets ('a' - 'z'). Consider path in which you can either move one unit right of current cell or move unit down of current cell i.e from you can either move to or move to .
Consider all the paths going from to in this matrix. Each such path can be described by sequence of labels ('a' - 'z') of all the cells visited on the way. There will be many such paths going from to . You have to find out lexicographic path in the matrix.
Lexicographic path can be described as:
Take all the possible paths in a vector and sort them. Print the path at position in the array.
INPUT:
First line will consist of two integers N and M. Next N lines will consist of M characters. Next line will consist of number K.
OUTPUT:
Output a string consisting of letters denoting the lexicographic path. If total number of paths in the matrix are less than K, print 1.
CONSTRAINTS:
All the characters in the matrix will be lowercase English alphabets ('a'-'z').
All the possible paths in this matrix are : . Thus Lexicographic path is .