Олимпиадный тренинг

Задача 33715. Artist Aquarius


Задача

Темы: Цикл while

The performer “Aquarius” there are two vessels, the first with a volume of A liters, the second with a volume of B liters, as well as a tap with water. Aquarius can perform the following operations:

  1. Fill vessel A (indicated by >A).
  2. Fill vessel B (indicated by >B).
  3. Pour water out of vessel A (denoted by A>).
  4. Pour water out of vessel B (denoted by B>).
  5. Pour water from vessel A into vessel B (indicated as A>B).
  6. Pour water from vessel B into vessel A (indicated as B>A).

The command to pour from one vessel to another results in either the first vessel being completely emptied or the second vessel being completely filled.

Input: The program receives as input three natural numbers A, B, N, not exceeding 104.
Output: It is necessary to display the Aquarius action algorithm, which allows you to get exactly N liters in one of the vessels, but if such an algorithm does not exist, then the program should display the text Impossible.

The number of operations in the algorithm should not exceed 105. It is guaranteed that if the problem has a solution, then there is a solution that contains no more than 105 operations.


Examples
# Input Output
1 3
5
1
>A
A>B
>A
A>B
2 3
5
6
Impossible