Banner Home Page DIY Contests Problems Ranklist Status Statistics
1003数据时完整的数据 暴力好像是过不去的啦~

D.The Quintessence of Chinese Culture——Mah-jong

Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 65535/32768K (Java/Other)
Total Submission(s) : 0   Accepted Submission(s) : 0

Font: Times New Roman | Verdana | Georgia

Font Size:

Problem Description

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: one of the 13 tiles (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) requires one tile, and other 12 tiles of the 13 tiles need one.
4) all are green color: the 14 tiles 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.

Input

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.

Output

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”.

Sample Input

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

Sample Output

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

Author

syu

Source

Developing School's Contest 6

Statistic | Submit | Back