Super Brain is a famous scientific reality and talent show aiming to find people with exceptional brainpower.
In one of the challenges called *Magic Cube Battle*, at first, various kinds of Magic Cubes are given to the contestant. Here shows the picture:
Among these Magic Cubes, one of them is a 2 × 2 × 2 cube, which means 8 mini-cubes construct it. For a combination of 2 × 2 mini-cubes which sharing a whole cube face, you can twist it 90 degrees in a clockwise or counterclockwise direction, and this twist operation is called one twist step.
More specifically, considering all faces of mini-cubes, there will be 24 faces painted in at most 6 different colours in total, and there will be precisely 4 faces painted in each kind of colour. If 4 mini-cubes' faces of the same colour rely on the same large cube face, we can call the large cube face as a completed face. Here shows the picture:
Because of the time for the contestant to twist the Magic Cube is very limited, for each state of the cube, the contestant is eager to know the possible number of completed faces after some foreseeable operation steps at most and at least.
Now you are asked to write a program to help them tackle this problem. Given a colour arrangement of all 24 faces from a scrambled 2 × 2 × 2 cube, please calculate the maximum and the minimum possible number of completed faces in no more than N twist steps.
Index of each face is shown as below: