##### IOI '00 - Beijing, China

A unit cube is a cube, whose corners have integer , , and coordinates. Two unit cubes are connected when they share a face. A -dimensional solid object (solid, for short) is a non-empty connected set of unit cubes (see Figure ). The volume of a solid is the number of unit cubes it contains. A block is a solid with volume at most . Two blocks have the same type when one can be obtained from the other by translations and rotations (not reflections). There are exactly block types (see Figure ). The colors in the figures only help to clarify the structure of the solids; they have no other meaning.

A set of blocks is a decomposition of a solid when the union of all blocks in equals , and no two distinct blocks in have a unit cube in common.

Your task is to write a program that, given a description of the block types and a solid , determines a smallest set of blocks into which can be decomposed. It only needs to report the types of these blocks as often as they occur in the decomposition.

#### Input Specification

In the input, we identify a unit cube by a line with three integers , , and , being the coordinate triple of its corner that minimizes . The input is divided into two parts, which were originally in two separate files but have been combined out of necessity for this online judge.

The first part of input describes the block types and will be the same for all evaluation runs. It contains the descriptions of the block types in Figure , sorted on type number. Each block type is described by a group of consecutive lines. The first line contains the integer identifying the block type . The second line contains the volume of the block type . The remaining lines contain three integers , and , each being one unit cube of the block type .

The second part of input describes the solid. The first line contains the volume of the solid . The remaining lines contain three integers , , , each being one unit cube of the solid .

#### Output Specification

The first line must contain one integer , being the smallest number of blocks into which the input solid can be decomposed. The second line lists type identifiers of the block types into which the input solid can be decomposed. There may be several solutions for each input file, and your program needs to output only one of them. The order of the numbers in the second line is immaterial.

#### Sample Input

```
1
1
1 1 1
2
2
1 1 1
1 2 1
3
3
1 1 1
1 2 1
1 3 1
4
3
1 1 1
1 2 1
1 1 2
5
4
1 1 1
1 2 1
1 3 1
1 4 1
6
4
1 1 1
1 2 1
1 1 2
1 2 2
7
4
1 1 1
1 2 1
1 1 2
1 1 3
8
4
1 1 1
1 2 1
1 3 1
1 2 2
9
4
1 2 1
1 3 1
1 1 2
1 2 2
10
4
2 1 1
1 2 1
2 2 1
2 1 2
11
4
1 1 1
1 2 1
2 2 1
1 1 2
12
4
2 2 1
2 1 2
1 2 2
2 2 2
18
2 1 1
4 1 1
2 3 1
4 3 1
2 1 2
3 1 2
4 1 2
1 2 2
2 2 2
3 2 2
4 2 2
2 3 2
3 3 2
4 3 2
4 2 3
4 2 4
4 2 5
5 2 5
```

#### Sample Output

```
5
7 10 2 10 12
```

The solid described in the sample input is the "horse" of Figure .

Note that the following, as well as all of their respective permutations, are also possibilities for the second line of output:

```
2 7 10 11 12
2 7 11 11 12
4 4 7 10 11
4 4 9 10 11
```

## Comments