Time limit
2s
Memory limit
128 MB
Two positive integers are friends if the set of distinct digits appearing in each integer is the same. For example, 123 and 32331313323213 are friends because both use exactly the digits 1, 2, and 3; 123 and 22121221 are not friends because their digit sets differ.
When two integers are not friends, they are almost friends if applying the following operation at most once to exactly one of the two integers can make them friends.
Choose two adjacent digits a and b in one integer. You may either subtract 1 from a and add 1 to b, or add 1 to a and subtract 1 from b. After the operation, both changed values must still be single digits, and the resulting integer must not start with 0.
Given two integers x and y, determine their relationship.
The input consists of three lines. Each line contains two positive integers x and y separated by a space.
For each input line, print one result line in the same order. Print friends if the two integers are friends, almost friends if they are almost friends, and nothing otherwise.
x and y do not start with 0.