{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eFour teams are taking part in football tournament.\r\nDuring this tournament, each team must play one game against every other team.\r\nSome of the games have already been played and the results are known.\r\nYour task is to determine the possible outcomes of the tournament,\r\nassuming that remaining games could have any result\r\n(each team can score any non-negative integer number of goals).\u003c/div\u003e\u003c/div\u003e\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eAfter each game, the winning team gets three points and the losing team\r\ngets zero points.\r\nIn case of a draw, both teams get one point.\r\nThe teams are ranked according to the sum of their points.\r\nIf two teams have the same number of points, they are \r\nranked by the difference between scored goals \u003ci\u003es\u003c/i\u003e and conceded goals \u003ci\u003ec\u003c/i\u003e\r\n(the more is \u003ci\u003es\u003c/i\u003e − \u003ci\u003ec\u003c/i\u003e, the better the rank).\r\nIf the values of \u003ci\u003es\u003c/i\u003e − \u003ci\u003ec\u003c/i\u003e are also the same,\r\nteams can be ranked either way due to other tie-breaking factors.\r\nIn the end, each team gets a distinct rank from 1 to 4.\r\nTwo outcomes of the tournament are different if there is a team which\r\nis ranked differently in these outcomes.\u003c/div\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eThe first line of input contains an integer \u003ci\u003en\u003c/i\u003e: the number of games\r\nalready played (0 ≤ \u003ci\u003en\u003c/i\u003e ≤ 6).\r\nNext \u003ci\u003en\u003c/i\u003e lines describe these games.\r\nEach game is described by integers \u003ci\u003ea\u003c/i\u003e, \u003ci\u003eb\u003c/i\u003e, \u003ci\u003ec\u003c/i\u003e, \u003ci\u003ed\u003c/i\u003e\r\nwhere \u003ci\u003ea\u003c/i\u003e and \u003ci\u003eb\u003c/i\u003e are the numbers of teams,\r\nand \u003ci\u003ec\u003c/i\u003e, \u003ci\u003ed\u003c/i\u003e are the number of goals scored by team \u003ci\u003ea\u003c/i\u003e and team \u003ci\u003eb\u003c/i\u003e\r\nrespectively (1 ≤ \u003ci\u003ea\u003c/i\u003e \u0026lt; \u003ci\u003eb\u003c/i\u003e ≤ 4; 0 ≤ \u003ci\u003ec\u003c/i\u003e, \u003ci\u003ed\u003c/i\u003e ≤ 10).\r\nIt is guaranteed that no two teams played more than one game\r\nagainst each other.\u003c/div\u003e\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eOn the first line output an integer \u003ci\u003em\u003c/i\u003e: the number of different possible\r\ntournament outcomes.\r\nEach of the next \u003ci\u003em\u003c/i\u003e lines should contain four integers:\r\nthe numbers of teams which get ranks 1, 2, 3 and 4 respectively.\r\nThe outcomes should be listed in lexicographical order.\u003c/div\u003e\u003c/div\u003e"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5\r\n1 2 1 0\r\n1 3 2 1\r\n1 4 3 2\r\n2 3 1 0\r\n2 4 5 4\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n1 2 3 4\r\n1 2 4 3\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Notes","value":{"format":"HTML","content":"\u003cdiv class\u003d\"problem_par\"\u003e\u003cdiv class\u003d\"problem_par_normal\"\u003eThe first team got nine points, and the second team got six points.\r\nThe team that wins the last game gets three points and takes the third place.\r\nIn case of a draw, teams 3 and 4 can be ranked either\r\nas 3-rd and 4-th respectively or vice versa.\u003c/div\u003e\u003c/div\u003e"}}]}