{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e Peking University Student Folk Music Band\u0026nbsp;has a history of more than 90 years. They play Chinese traditional music by Chinese traditional instruments, such as \u003cspan\u003e\u003cspan\u003ePipa\u003c/span\u003e\u003c/span\u003e, \u003cspan\u003e\u003cspan\u003eErhu\u003c/span\u003e\u003c/span\u003e and \u003cspan\u003e\u003cspan\u003eGuzheng\u003c/span\u003e\u003c/span\u003e, etc. Doctor Li is a member of that band, and also a former \u003cspan\u003e\u003cspan\u003eACMer\u003c/span\u003e\u003c/span\u003e. Now he is doing some research on Chinese ancient music. Many Chinese ancient music has only five kinds of tones, which can be denoted by \u0027C\u0027,\u0027D\u0027,\u0027E\u0027,\u0027G\u0027, and \u0027A\u0027. Given a piece of music score, Li wants to do some simple statistics.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e There are no more than 20 test cases.\u003c/p\u003e \n\u003cp\u003e In each test case:\u003c/p\u003e \n\u003cp\u003e The first line contains two integers n and m (2\u0026lt;\u003d n,m \u0026lt;\u003d 20), indicating that a piece of music score is represented by an n×m matrix of tones. Only \u0027C\u0027,\u0027D\u0027,\u0027E\u0027,\u0027G\u0027 and \u0027A\u0027 can appear in the matrix.\u003c/p\u003e \n\u003cp\u003e Then the n×m matrix follows.\u003c/p\u003e \n\u003cp\u003e The input ends with a line of \"0 0\".\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e For each test case:\u003c/p\u003e \n\u003cp\u003e For each kind of tone shown in the matrix, calculate the appearing times of it, and print the result in descending\u0026nbsp;order according to the appearing times. If more than one kind of tones has the same appearing times, print them in the lexicographical order.\u003c/p\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e\r\n\u003c/pre\u003e \n\u003cp\u003e 4 5\u003c/p\u003e \n\u003cp\u003e \u003cspan\u003e\u003cspan\u003eAGCDE\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e \n\u003cp\u003e \u003cspan\u003e\u003cspan\u003eAGDDE\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e \n\u003cp\u003e \u003cspan\u003e\u003cspan\u003eDDDDD\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e \n\u003cp\u003e \u003cspan\u003e\u003cspan\u003eEEEEE\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e \n\u003cp\u003e 2 4\u003c/p\u003e \n\u003cp\u003e \u003cspan\u003e\u003cspan\u003eGADC\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e \n\u003cp\u003e \u003cspan\u003e\u003cspan\u003eCDEE\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e \n\u003cp\u003e 0 0\u003c/p\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e\r\n\u003c/pre\u003e \n\u003cp\u003e D 8 E 7 A 2 G 2 C 1\u003c/p\u003e \n\u003cp\u003e C 2 D 2 E 2 A 1 G 1\u003c/p\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cp\u003e \u003cspan\u003e\u003cspan\u003esorces:\u003c/span\u003e\u003c/span\u003e \u003cspan\u003e\u003cspan\u003e2016年ICPC北京站(感谢北大出题)\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e"}}]}