SP303 UCUBE - The Unstable Cube

Description

A large cube (of size NxNxN) is given. At the beginning it consists of small blocks (1x1x1) and each block is painted in some color (different blocks may have the same color). But in the process of exploitation some blocks have disappeared. Given 6 photos of the unstable cube you have to calculate the maximum possible number of blocks that still remain in the unstable cube. It is possible that the unstable cube consists of more than one part.

Input Format

_t_ – the number of test cases, then _t_ test cases follow. _N_ - size of the big cube _\[1

Output Format

For each test case output one integer: the required maximum number of blocks remaining in the unstable cube.