405925: GYM102157 6 Kitchen Plates

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

6. Kitchen Platestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

You are given 5 different sizes of kitchen plates. Each plate is marked with a letter A, B, C, D, or E. You are given $$$5$$$ statements comparing two different plates, you need to rearrange the plates from smallest size to biggest size.

For example: the sizes of these plates

Input

The input consist of $$$5$$$ lines. In each line there will be $$$3$$$ characters, the first and last character will be either A, B, C, D, or E and the middle character will be either > or < describing the comparison between two plates sizes. No two plates will be equal.

Output

The output consist of 5 characters, the sorted order of balls from smallest to biggest plate. Otherwise, if the statements are contradicting print impossible. If there are multiple answers, print any of them

ExamplesInput
D>B
A>D
E<C
A>B
B>C
Output
ECBDA
Input
B>E
A>B
E>A
C<B
D<B
Output
impossible

加入题单

算法标签: