In Old Delhi, Kavya Sethi sells sacks full of small spice tins. Every sack has a number on it. Inside, there is one tin for each digit of that number.
Kavya swaps two sacks only if they have the same tins. They must have the same digits, and each digit must come the same number of times. The order does not matter. Some sacks also have a red stamp, which means the number is negative. A sack with a red stamp can only be swapped for another sack with a red stamp.
Kavya empties the two sacks into the two pans of her magic scale. It does not weigh the tins. It stays straight only when the swap is fair. Tonight many traders have come, and the scale is too slow. Write a program that does this check for her.
