There are N (1 ≤ N ≤ 10^{5}) dice at the casino’s "Royal Flush" storehouse. Some of them are equal, i.e. one can transform one die to another by properly rotating it. Let’s say that two dice have the same scheme if it’s possible to obtain one of them from another by a series of rotation. In other case (no rotations of the first die lead us to the second die) let’s say that dice have different schemes. Your task is to define the dice with the same scheme.
Input
The first line of the input contains the number N. Next N lines contain descriptions of the dice. Each line contains exactly one description of the die. A line describes the die in 6 numbers (separated with spaces): the number of points on the left side of the die, then on the right side, on the top, on the forward side, on the bottom and on the backward side. Certainly, those 6 numbers represent a permutation of integer numbers from 1 to 6 inclusively.
Output
The first line of the output should contain the only number Q of different die’s schemes at the storehouse. Next Q lines should contain the numbers of dice with the same scheme. To be more precisely the second line must begin with 1 and after that (separated by spaces) numbers of dice with the same as die #1 scheme must follow.
We assume that all dice from the input are numbered from 1 to N. The third line (if not all the dice have the same scheme) must begin with the smallest possible number with the scheme different from the scheme of the die #1. This number (say P) is followed by numbers of dice with the same scheme as the scheme of the die #P. All next lines must be printed in the same manner. Numbers in each line of the output must be sorted in increasing order.
Sample
input  output 

3
1 2 6 4 5 3
4 3 6 2 5 1
4 1 3 6 2 5
 2
1 2
3

Problem Source: Ural State University Internal Contest '99 #2