问题3114--The Quintessence of Chinese Culture——Mah-jong

3114: The Quintessence of Chinese Culture——Mah-jong

[命题人 : ]
时间限制 : 1.000 sec  内存限制 : 64 MB

题目描述

It is uncertain when mah-jong originated, but mah-jong is the quintessence of Chinese culture, which is undoubtedly. Now, mah-jong is not only popular in China, but also in Japan, Europe and America. There are some rules to introduce. In the game, there are Characters, Bamboos, Dots, and each of them are 36 Tiles. And east Wind, south Wind, west Wind, north Wind, red Dragon, green Dragon, white Dragon, each of them are 4 Tiles. All of them are 136 Tiles.
Characters: one Character, two Character, three Character, four Character, five Character, six Character, seven Character, eight Character, nine Character. Bamboos: one Bamboo, two Bamboo, three Bamboo, four Bamboo, five Bamboo, six Bamboo, seven Bamboo, eight Bamboo, nine Bamboo. Dots: one Dot, two Dot, three Dot, four Dot, five Dot, six Dot, seven Dot, eight Dot, nine Dot. At the start, the player has 13 tiles. If you get a tile or other players threw out a tile, which can meet the requirements of a number of styles of win mentioned below, you will win! Many players are not very good at judging which tiles can make it, and now your task is to solve this problem. There are many kinds of mah-jong’s wining styles, but now only to introduce the following: 1) 111(123), 111(123), 111(123), 111(123), 11. 111(123)means 111 or 123 ,111 means three cards which are the same, such as three Character, three Character, three Character. 123 means three cards are the same type and continuous, such as three Dot, four Dot, five Dot. 11 means two cards are the same, such as white Dragon, white Dragon. 2) seven pairs :11,11,11,11,11,11,11. 11 means two tiles which are the same. 3) the thirteen orphans: the 14 tiles only consist of one Character, nine Character, one Bamboo, nine Bamboo, one Dot, nine Dot, east Wind, south Wind, west Wind, north Wind, red Dragon, green Dragon and white Dragon,and must contain 13 diffrent kinds of tiles. 4) all are green color: the 14 tiles only consist of two Bamboo, three Bamboo, four Bamboo, six Bamboo, eight Bamboo, green Dragon. In this problem, we will tell you the 13 known tiles, your task is to determine which tiles can make the 14 tiles meet with the four styles mentioned above, and then output these tiles, according to the sequence of Character, Bamboo, Dot, east Wind, south Wind, west Wind, north Wind, red Dragon, green Dragon, white Dragon, the same Characters, Bamboo, Dot according to id from one to nine.

输入

The first line is the T, and there are T sets of data. Each set consist of one line, and each line has 13 strings, separated by a comma and a space. Each string stands for a tile.

输出

For each set, output all the tiles that can meet the requirement. Two tiles are separated by a comma, and a space. If no tile that can satisfy the requirement, print “None”.

样例输入 Copy

2
two Character, two Character, three Character, three Character, three Character, four Character, five Character, three Dot, four Dot, five Dot, one Bamboo, two Bamboo, three Bamboo
one Character, nine Character, one Bamboo, nine Bamboo, one Dot, nine Dot, east Wind, south Wind, west Wind, north Wind, red Dragon, green Dragon, white Dragon

样例输出 Copy

two Character, three Character, six Character
one Character, nine Character, one Bamboo, nine Bamboo, one Dot, nine Dot, east Wind, south Wind, west Wind, north Wind, red Dragon, green Dragon, white Dragon

来源/分类