{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"An ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smallest to largest. For example, the sorted sequence A, B, C, D implies that A \u0026lt; B, B \u0026lt; C and C \u0026lt; D. in this problem, we will give you a set of relations of the form A \u0026lt; B and ask you to determine whether a sorted order has been specified or not. "}},{"title":"Input","value":{"format":"HTML","content":"Input consists of multiple problem instances. Each instance starts with a line containing two positive integers n and m. the first value indicated the number of objects to sort, where 2 \u0026lt;\u003d n \u0026lt;\u003d 26. The objects to be sorted will be the first n characters of the uppercase alphabet. The second value m indicates the number of relations of the form A \u0026lt; B which will be given in this problem instance. Next will be m lines, each containing one such relation consisting of three characters: an uppercase letter, the character \"\u0026lt;\" and a second uppercase letter. No letter will be outside the range of the first n letters of the alphabet. Values of n \u003d m \u003d 0 indicate end of input."}},{"title":"Output","value":{"format":"HTML","content":"For each problem instance, output consists of one line. This line should be one of the following three:\r\u003cbr\u003e\r\u003cbr\u003eSorted sequence determined after xxx relations: yyy...y.\r\u003cbr\u003eSorted sequence cannot be determined.\r\u003cbr\u003eInconsistency found after xxx relations.\r\u003cbr\u003e\r\u003cbr\u003ewhere xxx is the number of relations processed at the time either a sorted sequence is determined or an inconsistency is found, whichever comes first, and yyy...y is the sorted, ascending sequence.\r\u003cbr\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\u003e4 6\r\nA\u0026amp;lt;B\r\nA\u0026amp;lt;C\r\nB\u0026amp;lt;C\r\nC\u0026amp;lt;D\r\nB\u0026amp;lt;D\r\nA\u0026amp;lt;B\r\n3 2\r\nA\u0026amp;lt;B\r\nB\u0026amp;lt;A\r\n26 1\r\nA\u0026amp;lt;Z\r\n0 0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eSorted sequence determined after 4 relations: ABCD.\r\nInconsistency found after 2 relations.\r\nSorted sequence cannot be determined.\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}