John found six dominoes. A domino is a rectangular tile with a line dividing its face into two square halves. Each half is marked with a number of spots. John wants to build a three-stage pyramid from these dominoes The first level should consist of three dominoes, the second level of two dominoes and the highest of one domino The levels are arranged in such a way that the peak of the pyramid is at the center that is, each level is positioned over the center of the level below it. There is also an additional condition The number of spots on each domino halt should be the same as the number of spots on the half positioned beneath it. Note that this does not apply to neighboring dominoes on the same level
Is it possible to build a pyramid from these dominoes, as described above? Dominoes can be freely rearranged. We also assume that dominoes can be rotated (that is, the piece (X, Y) can be treated as or (Y, XI, where X denotes the number of spots in the first half domino and Y denotes the number of spots in the second halfl domino)
Write a function
string solution(vector-int &A)
that, given an anay A consisting of twelve integers (the first and the second integer describe the first domino, the third and the fourth integer describe the second domino, etc.), retums the string "YES", possible to build a correct pyramid from these dominoes