#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
int a, b, c;
char ch;
scanf("%d %d %d", &a, &b, &c); getchar();
int zj;
if (a > b)
{
zj = a; a = b; b = zj;
}
if (a > c)
{
zj = a; a = c; c = zj;
}
if (b > c)
{
zj = b; b = c; c = zj;
}
ch = getchar();
while (ch!= '\n')
{
switch (ch)
{
case 'A': printf("%d ", a); break;
case 'B': printf("%d ", b); break;
case 'C': printf("%d ", c); break;
default:printf("输入错误");
}
ch = getchar();
}
return 0;
}