{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eTrading is a subtle thing. A successful huckster not only should reasonably choose the time to sell the goods and master the art of touting, but also thoroughly examine the market. It\u0027s important to know which of the merchants trade with each other and which don\u0027t. Sometimes the merchants don\u0027t directly trade, but their goods still \u001cnd a way to each other via other merchants. For example, if merchants \u003cstrong\u003eA\u003c/strong\u003e and \u003cstrong\u003eB\u003c/strong\u003e trade directly and merchants \u003cstrong\u003eB\u003c/strong\u003e and \u003cstrong\u003eC\u003c/strong\u003e trade directly, then goods from \u003cstrong\u003eA\u003c/strong\u003e and \u003cstrong\u003eC\u003c/strong\u003e will get to each other via merchant \u003cstrong\u003eB\u003c/strong\u003e. In general, the goods may get from a merchant to another via any number of intermediate merchants. Another important concept are the inseparable pairs\u0016 - these are the pairs of merchants which trade directly, and no sequence of intermediate merchants exists through which the merchants in the pair could trade indirectly.\u003c/p\u003e\n\n\u003cp\u003eManao wants to become a successful huckster. We don\u0027t know what necessary skills he does possess, but he surely lacks the knowledge about market situation. What he currently knows is that there are \u003cstrong\u003eN\u003c/strong\u003e merchants at the market, \u003cstrong\u003eM\u003c/strong\u003e pairs trade directly and \u003cstrong\u003eK\u003c/strong\u003e of them are inseparable. What he needs is the information of sort \u0010\"\u003cstrong\u003eA\u003c/strong\u003e trades with \u003cstrong\u003eB\u003c/strong\u003e, \u003cstrong\u003eC\u003c/strong\u003e trades with \u003cstrong\u003eD\u003c/strong\u003e, \u003cstrong\u003eX\u003c/strong\u003e trades with \u003cstrong\u003eA\u003c/strong\u003e\u0011\". In most cases, this is ambiguous, but at the moment any \u001ctting scheme would su\u001ece.\u003c/p\u003e\n\n\u003cp\u003eYou\u0027re given \u003cstrong\u003eT\u003c/strong\u003e scenarios with the values of \u003cstrong\u003eN\u003c/strong\u003e, \u003cstrong\u003eM\u003c/strong\u003e and \u003cstrong\u003eK\u003c/strong\u003e. For each of them determine whether a corresponding trade market exists and if yes, output its description. Merchants are numbered in some order from \u003cstrong\u003e1\u003c/strong\u003e to \u003cstrong\u003eN\u003c/strong\u003e, the description of the trade market is the set of all pairs of merchants who trade directly.\u003c/p\u003e\n\n\u003cp\u003e\u003ch2\u003eInput\u003c/h2\u003e\u003c/p\u003e\n\n\u003cp\u003eThe \u001cfirst line contains the number of scenarios \u003cstrong\u003eT\u003c/strong\u003e. Each of the following \u003cstrong\u003eT\u003c/strong\u003e lines contains three numbers \u003cstrong\u003eN\u003c/strong\u003e, \u003cstrong\u003eM\u003c/strong\u003e, \u003cstrong\u003eK\u003c/strong\u003e (\u003cstrong\u003e2\u003c/strong\u003e ≤ \u003cstrong\u003eN\u003c/strong\u003e ≤ \u003cstrong\u003e100\u003c/strong\u003e, \u003cstrong\u003e0\u003c/strong\u003e ≤ \u003cstrong\u003eK\u003c/strong\u003e ≤ \u003cstrong\u003eM\u003c/strong\u003e ≤ \u003cstrong\u003eN\u003c/strong\u003e·(\u003cstrong\u003eN\u003c/strong\u003e - \u003cstrong\u003e1\u003c/strong\u003e)/\u003cstrong\u003e2\u003c/strong\u003e).\u003c/p\u003e\n\n\u003cp\u003eThe number of scenarios in a single input does \u003cstrong\u003e100\u003c/strong\u003e.\u003c/p\u003e\n\n\u003cp\u003eSum of \u003cstrong\u003eM\u003c/strong\u003e\u0027s over all scenarios in a single input does not exceed \u003cstrong\u003e50000\u003c/strong\u003e.\u003c/p\u003e\n\n\u003cp\u003e\u003ch2\u003eOutput\u003c/h2\u003e\u003c/p\u003e\n\n\u003cp\u003eFor each of the \u003cstrong\u003eT\u003c/strong\u003e scenarios output \"\u003cstrong\u003eNO SOLUTION\u003c/strong\u003e\" (without quotes) if the corresponding trade market does not exist. Otherwise, output \"\u003cstrong\u003eTRADE MARKET FOUND\u003c/strong\u003e\", followed by \u003cstrong\u003eM\u003c/strong\u003e lines. Each of the lines must contain a pair of numbers separated by a space -\u0016 the numbers of the merchants trading directly.\u003c/p\u003e\n\n"}},{"title":"Example","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\u003e3\n4 3 0\n4 2 0\n5 5 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eTRADE MARKET FOUND\n1 2\n2 3\n3 1\nNO SOLUTION\nTRADE MARKET FOUND\n1 2\n2 3\n3 1\n1 4\n1 5\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}