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 row and column becomes palindromic.
Input :
Output :
Constraints :
The given arrangement already have all the rows and columns palindromic.