{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp align\u003d\"JUSTIFY\"\u003e\r\n\t\u003ci\u003eDominoes \u0026ndash; 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\r\n\tThe 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/i\u003e\u003c/p\u003e\r\n\u003cp align\u003d\"JUSTIFY\"\u003e\r\n\t\u003ci\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/i\u003e\u003c/p\u003e\r\n\u003cp align\u003d\"JUSTIFY\"\u003e\r\n\t\u003ci\u003e\u003cfont face\u003d\"Times New Roman\"\u003eENCYCLOP\u0026AElig;DIA BRITANNICA \u003c/font\u003e\u003c/i\u003e\u003c/p\u003e\r\n\u003cp align\u003d\"JUSTIFY\"\u003e\r\n\tGiven 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"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e\r\n\tThe first line of the input contains a single integer \u003cem\u003eN\u003c/em\u003e (1 \u0026le; \u003cem\u003eN\u003c/em\u003e \u0026le; 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"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e\r\n\tWrite \u0026ldquo;No solution\u0026rdquo; 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 \u0026ldquo;+\u0026rdquo; or \u0026ldquo;-\u0026ldquo; (first means that you not rotate that piece, and second if you rotate it).\u003c/p\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e5\r\n1 2\r\n2 4\r\n2 4\r\n6 4\r\n2 1\r\n\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e2 -\r\n5 +\r\n1 +\r\n3 +\r\n4 -\r\n\u003c/pre\u003e"}}]}