#include<bits/stdc++.h> using namespace std; int main(){ int a[3],b[3]; for(int i=0; i<3; i++) cin>>a[i]; sort(a,a+3); getchar(); for(int i=0; i<3; i++) b[i]=int(getchar()-'A'); for(int i=0; i<3; i++) cout<<a[b[i]]<<" "; return 0; }