Consider the situation of an ideal forest, where trees grow on a regular finite euclidean lattice. At every site only one tree grows, and it can be of one among n species. Each species is denoted by a single character ({A, B, C, . . .} are valid species, for instance). Two trees of the same species are considered neighbors if the maximum absolute difference between their coordinates is one. Families of (rather specialized) monkeys are released, one at a time, in this euclidean forest. Each family will occupy all neighboring tress of a single species which have not been taken yet by another family. The monkeys are released from left to right and from top to bottom. Given the map of the forest, build the map of the monkeys families, starting with ‘1’ and numbering them consecutively. Input Input file has the lines of a matrix of single characters, separated by single blank spaces. Next matrices (each matrix is a different instance to the problem) will be preceded by a line with a single ‘%’ character and then the same structure as before. Output Output file has to show lines of integers separated by as many blank spaces as required to align columns to the right. The solution to each instance must be finished by a line with a single ‘%’ character. Sample Input ABDECCD FFWDDDD PWEWWWW % aAbBcdEt aaaaacct efghcaat Sample Output 1234553 6673333 8797777 % 12345678 11111558 9 10 11 12 5 1 1 8 %