The 30th ACM/ICPC regional contest Chengdu site has been held at Chengdu on November 5 & 6, 2005. As is known to all, Chengdu is a beautiful city. In this city, people lead a leisure life. In their spare time, they like to play a kind of card game - Mahjong. This kind of game is complicated, but now we will simplify the rules.
There is only one type of cards, which are numbered from 1 to 9. Everyone has 13 cards, and the total number of same card are exactly 4. At the beginning, every player get 13 cards. If one wants to win this game, he needs to get one more card. The permutation of the 14 cards should match the following rules. First, we define two cards with the same number as pattern A, three cards with the same number as pattern B, and three cards whose numbers continuously increase as pattern C. The 14 cards should be divided into following pattern combinations:
In each combination, the order of the patterns is arbitrary. For example, suppose you have owned the following cards:
1 2 3 2 2 2 3 4 5 6 7 8 9
and if you get another card with number 9, you will win. (These cards can be described as: C B C C A)
Your program must, given the current 13 cards, determine which card is needed to win the game. If there are several solutions, list them in increase order.Input
The problem has multiple cases. For each case, there is only one line. The line contains the number of the 13 cards. The numbers are in the range from 1 to 9 each, separated by spaces.
Process to the end of file.
Output must contain an ordered list of card number(s), each of which is needed to win the game, separated by spaces. If there is no such card, print "no solution" without the quote.Sample Input
1 1 1 2 2 2 4 4 4 5 5 5 9 1 1 1 2 2 2 4 4 4 5 5 6 9Sample Output
9 no solution