The input and output sizes can be very large, so fast I/O is recommended.
For a positive integer , consider a grid. Each cell must contain one integer among , and every integer must be used exactly once.
Consider a pair of cells sharing an edge. If the two written integers are coprime, this pair is called a good pair. Otherwise it is called a bad pair.
You are given values . For each , output one grid. Fewer bad pairs give a higher score.
Input
The input is given in the following format.
Output
For each test case (), print lines. Each line must contain integers separated by spaces.
The printed integers for that test case must be a permutation of .
Constraints
- .
- ().
- .
Subtasks
Scoring
For each test case , if the printed grid is not a permutation of , define .
Otherwise, let be the number of bad pairs, and define as follows.
Define as follows.
The score of the first subtask is as follows.
For the second subtask, the score of each data file is as follows.
The score of the second subtask is the minimum score among all data files.
Samples
This sample is for reference only and is not included in the actual judge data.