King's Poker

No attempts yetTime limit1sMemory limit128 MB

Problem

Poker is one of the most widely played card games, and King's Poker is one of its variations. The game uses a standard deck of 52 cards. Each card has a suit and a rank, but in King's Poker the suit is irrelevant and only the rank matters. There are 13 ranks: Ace (1), 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack (11), Queen (12), and King (13). As the name suggests, the King (13) is the highest rank.

Each player is dealt a hand of exactly three cards. A hand is one of three types:

  • Set: all three cards have the same rank.
  • Pair: exactly two cards have the same rank, and the third card is unmatched.
  • No-pair: all three cards have different ranks.

Hands are compared using the following rules:

  • Any set beats any pair and any no-pair.
  • Any pair beats any no-pair.
  • Between two sets, the set with the higher rank wins.
  • Between two pairs whose matched cards have different ranks, the pair with the higher matched rank wins.
  • Between two pairs whose matched cards have the same rank, the unmatched cards are compared and the pair with the higher unmatched card wins; if the unmatched cards are also equal, the two hands tie.

Given a single hand of King's Poker, find the set or pair of the lowest rank (the weakest one) that beats it.

Input

The input consists of several test cases. Each test case is a single line with three integers $A$, $B$, and $C$, the ranks of the three cards in a hand ($1 \le A, B, C \le 13$).

The last test case is followed by a line containing three zeros, which must not be processed.

Output

For each test case, print a single line.

If a set or a pair beats the given hand, print the lowest-ranked such hand: list the ranks of its three cards in non-decreasing order, separated by single spaces. If no set or pair beats the given hand, print a single asterisk *.