lst1=['A','B','C']
lst2=[0,0,0]
in1=input()
in2=input()
in3=input()
s=""
if(in1[1]=='>'):
temp=in1[0]
lst2[lst1.index((temp))]=lst2[lst1.index((temp))]+1
elif(in1[1]=='<'):
temp=in1[2]
lst2[lst1.index((temp))]=lst2[lst1.index((temp))]+1
if(in2[1]=='>'):
temp=in2[0]
lst2[lst1.index((temp))]=lst2[lst1.index((temp))]+1
elif(in2[1]=='<'):
temp=in2[2]
lst2[lst1.index((temp))]=lst2[lst1.index((temp))]+1
if(in3[1]=='>'):
temp=in3[0]
lst2[lst1.index((temp))]=lst2[lst1.index((temp))]+1
elif(in3[1]=='<'):
temp=in3[2]
lst2[lst1.index((temp))]=lst2[lst1.index((temp))]+1
if(lst2[0]==lst2[1]==lst2[2]==1):
s="Impossible"
else:
for i in range(0,3):
t=lst2.index(min(lst2))
s=s+lst1[t]
lst2[t]=100
print(s)
#include <cstdio>
#include <iostream>
#include <map>
int main(){
std::map<char,int> count;
count.insert(std::pair<char,int>('A',0));
count.insert(std::pair<char,int>('B',0));
count.insert(std::pair<char,int>('C',0));
for(int k = 0; k < 3; k++){
std::string temp; getline(std::cin, temp);
if(temp[1] == '<'){++count[temp[2]];}
else{++count[temp[0]];}
}
if(count['A'] == 1 && count['B'] == 1 && count['C'] == 1){puts("Impossible");}
else{
if(count['A'] == 0){printf("A");}
else if(count['B'] == 0){printf("B");}
else if(count['C'] == 0){printf("C");}
if(count['A'] == 1){printf("A");}
else if(count['B'] == 1){printf("B");}
else if(count['C'] == 1){printf("C");}
if(count['A'] == 2){printf("A");}
else if(count['B'] == 2){printf("B");}
else if(count['C'] == 2){printf("C");}
}
puts("");
return 0;
}
174. Dungeon Game | 127. Word Ladder |
123. Best Time to Buy and Sell Stock III | 85. Maximal Rectangle |
84. Largest Rectangle in Histogram | 60. Permutation Sequence |
42. Trapping Rain Water | 32. Longest Valid Parentheses |
Cutting a material | Bubble Sort |
Number of triangles | AND path in a binary tree |
Factorial equations | Removal of vertices |
Happy segments | Cyclic shifts |
Zoos | Build a graph |
Almost correct bracket sequence | Count of integers |
Differences of the permutations | Doctor's Secret |
Back to School | I am Easy |
Teddy and Tweety | Partitioning binary strings |
Special sets | Smallest chosen word |
Going to office | Color the boxes |