Woburn Challenge 2002
It seems as though the monkeys are really getting their act together. The Head-Monkey, with the help of the Big-White Monkey, managed to commandeer a Flowers By Irene truck, gaining access to the finest spy equipment the NSA can develop. Armed with these tools, the Head-Monkey's loyal minion, Tiny, snuck into Bo Vine's complex and overheard his plan to use the dreaded APE on the monkeys. The Head-Monkey, upon hearing these shocking developments, was compelled to enlist the services of her trusty friends, the apes, bison, parrots and three-eyed fish, of Old MacDonald's Farm, of course. You see, Old MacDonald and the Head-Monkey go back many years, but that's a story for another day. There seems to be a problem, however. The Head-Monkey has counted the total number of heads, feet, tails and eyes that there are, but she can't keep the collection of animals still for long enough to count exactly how many of each type there are! The Head-Monkey knows the following:
- Each animal has one head!
- An ape has two feet, two eyes, and no tail.
- A bison has four feet, two eyes, and one tail.
- A parrot has two feet, one eye (it's a pirate's bird, and it has an eye patch) and one tail.
- A three-eyed fish has zero feet, three eyes, and one tail.
Input Specification
The first line of input contains a single integer,
, indicating the number of test cases.
Each test case consists of four integers, indicating the number of
heads, feet, eyes and tails.
Note that these integers will be less than .
Output Specification
Output the following on a separate line for each test case:
The number of apes, bison, parrots and fish, in that order, separated by
a space.
If the values you obtain indicate fractional animals, or worse, negative
animals, output FUNNY FARM
!
Sample Input
3
10 16 21 9
10 24 19 6
11 25 20 6
Sample Output
1 2 3 4
4 3 2 1
FUNNY FARM
Comments