{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp align\u003d\"JUSTIFY\"\u003eDominoes – game played with small, rectangular blocks of wood or other material, each identified by a number of dots, or pips, on its face. The blocks usually are called bones, dominoes, or pieces and sometimes men, stones, or even cards.\u003cbr\u003e The face of each piece is divided, by a line or ridge, into two squares, each of which is marked as would be a pair of dice...\u003c/p\u003e \u003cp align\u003d\"JUSTIFY\"\u003eThe principle in nearly all modern dominoes games is to match one end of a piece to another that is identically or reciprocally numbered.\u003c/p\u003e \u003cfont face\u003d\"Times New Roman\"\u003e\u003cp align\u003d\"JUSTIFY\"\u003eENCYCLOPÆDIA BRITANNICA \u003c/p\u003e \u003c/font\u003e\u003c/i\u003e\u003cfont\u003e \u003c/font\u003e\u003cp align\u003d\"JUSTIFY\"\u003e \u003c/p\u003e\u003cp align\u003d\"JUSTIFY\"\u003eGiven a set of domino pieces where each side is marked with two digits from 0 to 6. Your task is to arrange pieces in a line such way, that they touch through equal marked sides. It is possible to rotate pieces changing left and right side.\u003c/p\u003e \u003cp align\u003d\"JUSTIFY\"\u003e \u003cb\u003e\u003c/b\u003e\u003c/p\u003e\u003cp align\u003d\"JUSTIFY\"\u003eInput\u003c/p\u003e \u003cp align\u003d\"JUSTIFY\"\u003eThe first line of the input contains a single integer \u003cem\u003eN\u003c/em\u003e (1 ≤ \u003cem\u003eN\u003c/em\u003e ≤ 100) representing the total number of pieces in the domino set. The following \u003cem\u003eN\u003c/em\u003e lines describe pieces. Each piece is represented on a separate line in a form of two digits from 0 to 6 separated by a space.\u003c/p\u003e \u003cp align\u003d\"JUSTIFY\"\u003e \u003cb\u003e\u003c/b\u003e\u003c/p\u003e\u003cp align\u003d\"JUSTIFY\"\u003eOutput\u003c/p\u003e \u003cp align\u003d\"JUSTIFY\"\u003eWrite “No solution” if it is impossible to arrange them described way. If it is possible, write any of way. Pieces must be written in left-to-right order. Every of N lines must contains number of current domino piece and sign “+” or “-“ (first means that you not rotate that piece, and second if you rotate it).\u003c/p\u003e \u003cp align\u003d\"JUSTIFY\"\u003e \u003c/p\u003e\u003cp align\u003d\"JUSTIFY\"\u003eSample Input\u003c/p\u003e \u003cfont face\u003d\"Courier New\"\u003e \u003cpre\u003e5\n1 2\n2 4\n2 4\n6 4\n2 1\n\u003c/pre\u003e \u003cp align\u003d\"JUSTIFY\"\u003e \u003c/p\u003e\u003c/font\u003e \u003cp align\u003d\"JUSTIFY\"\u003eSample Output\u003c/p\u003e \u003cfont face\u003d\"Courier New\"\u003e \u003cpre\u003e2 -\n5 +\n1 +\n3 +\n4 -\n\u003c/pre\u003e \u003c/font\u003e "}}]}