Shaman Maktsakhmetl is conducting a training ritual called "-Highlander". He gave each of the tribespeople clay tablets indicating which fellow tribesperson they should watch over. Each tablet had a feather of one of colors attached. Tablets marked with the same color formed one or several cycles, with each of the participants included in one of them exactly once.
But a strong mountain wind blew off all the feathers and carried them into the desert. Help Maktsakhmetl put the feathers back on the tablets so that for each color, the tablets form cycles that include each participant exactly once.
The first line of the input file contains the numbers and — the number of tribe members and the number of feather colors (1 \leq n \leq 500, 1 \leq k \leq 20).
Each of the next lines contains numbers from to — the indices of the tribespeople whom the respective participant was assigned to watch over. It is guaranteed that no one was assigned to watch over themselves. It is possible that some tribesperson received several tablets with the same target.
It is guaranteed that there is a way to assign the feathers to the tablets as required.
Output the table in the same format, rearranging the numbers in each row so that the th column describes the tablets with feathers of color and they form one or several cycles, each involving each participant exactly once. If there are multiple possible answers, print any of them.
Example 1