描述
Plato believed what we perceive is but a shadow of reality. Recent archaeological excavations have uncovered evidence that this belief may have been encouraged by Plato's youthful amusement with cleverly-designed blocks. The blocks have the curious property that, when held with any face toward a light source, they cast shadows of various letters, numbers, shapes, and patterns. It is possible for three faces incident to a corner to correspond to three different shadow patterns. Opposite faces, of course, cast shadows which are mirror images of one another.
The blocks are formed by gluing together small cubes to form a single, connected object. As an example, the figures below show, layer by layer, the internal structure of a block which can cast shadows of the letters "E", "G", or "B".
Only a partial set of blocks was discovered, but the curious scientists would like to determine what combinations of shadows are possible. Your program, the solution to this problem, will help them! The program will input groups of shadow patterns, and for each group will report whether or not a solid can be constructed that will cast those three shadows.
柏拉图认为我们所感知到的不过是现实的影子。最近的考古发掘已经发现证据表明,这种信仰可能是受到了柏拉图年轻时对巧妙设计的积木的乐趣的鼓励。这些积木有一种奇特的特性,当任何面朝光源的时候,它们会投射出各种字母、数字、形状和图案的阴影。有可能三个面对一个角落事件对应三种不同的阴影模式。当然,相反的面孔投下的影子是彼此的镜像。这些块是通过将小立方体粘合在一起形成一个单独的、连接的对象。例如,下面的图片一层一层地显示了一个块的内部结构,它可以投射字母“ E”、“ G”或“ B”的阴影。虽然只发现了部分块,但好奇的科学家们想要确定阴影的组合是可能的。写出这个问题的解决方案,将帮助他们!该程序将输入阴影模式组,并为每组将报告是否可以建立一个立体,将投射这三个阴影。
输入
The input contains a sequence of data sets, each specifying a dimension and three shadow patterns. The first line of a data set contains a positive integer 1 <= n <= 20 that specifies the dimensions of the input patterns. The remainder of the data se