File will be given in this format with the two dimensions at the top, the letters in the middle, and the words we have to search for at the bottom.
I tried to use oth