You are given a 2-d grid of N rows and M columns containing lower case alphabets only. You need to check whether it is possible to rearrange the complete grid so that each r