There are 41 coins, numbered by the integers from 0 to 40(where coin 0 is sure true coin), exactly one coin is false and differs in weight from other coins (while all other coins are equal in weight).
Using a balance, one is able to determine if the weight of objects in the left pan is less than, greater than, or equal to the weight of objects in the right pan. Then begin to weight various groups of coins by placing equal numbers of coins in the left pan and in the right pan. Find out the false coins by weighing the following four times.
| Left pan | Right pan |
1st | 1 2 7 8 13 14 19 20 25 26 31 32 37 38 | 0 4 5 10 11 16 17 22 23 28 29 34 35 40 |
2nd | 0 3 6 11 13 14 16 21 24 29 31 32 34 39 | 2 4 5 7 12 15 20 22 23 25 30 33 38 40 |
3rd | 5 7 9 11 13 14 16 18 20 22 33 35 37 39 | 0 6 8 10 12 15 17 19 21 32 34 36 38 40 |
4th | 0 15 17 19 21 23 25 27 29 31 33 35 37 39 | 14 16 18 20 22 24 26 28 30 32 34 36 38 40 |
The results of the four times weightings were recorded. You are to write a program to determine the identifier of the false coin using the results of these weightings.
输入描述:
There are multiple test cases.
For each test case, there are exactly 4 characters in one line, i-th character is the result of i-th weighting, which contains one of the following characters: '<', '>', or '='. It represents the result of the weighting:
'<' means that the weight of coins in the left pan is less than the weight of coins in the right pan,
'>' means that the weight of coins in the left pan is greater than the weight of coins in the right pan,
'=' means that the weight of coins in the left pan is equal to the weight of coins in the right pan.
Input is terminated by end of file.
输出描述:
For each case, your program will output one line in following format:
N light/heavy
N is a positive integer: the number of false coins. If coin N is light than true coin, following “light” (without quotation marks), otherwise “heavy” (without quotation marks).
示例1
输出
复制
1 heavy
2 heavy
40 light
40 heavy