The input contains several test cases. Each test case is given by a line with the six integers a, m, p, q, r, and s as described above (1 ≤ a, m, p, q, r, s ≤ 109, p ≤ q and r ≤ s).
The last test case is followed by a line with six zeros.
For each test case, display its case number followed by the best program as described above. Display the word "empty" if the best program uses no operations. Display the word 'impossible' if there is no program meeting the specifications.
Display the program as a sequence of space-separated strings, alternating between strings of the form 'nA' and strings of the form 'nM', where n > 0. Strings of the former type indicate n consecutive 'A' operations, and strings of the latter type indicate n consecutive 'M' operations.
Follow the format of the sample output.