#include <iostream>
#include <map>
#include <vector>
using namespace std;
int main(){
map<char, int> table;
table['A'] = 10;
table['B'] = 11;
table['C'] = 12;
table['D'] = 13;
table['E'] = 14;
table['F'] = 15;
table['G'] = 16;
table['H'] = 17;
table['I'] = 34;
table['J'] = 18;
table['K'] = 19;
table['L'] = 20;
table['M'] = 21;
table['N'] = 22;
table['O'] = 35;
table['P'] = 23;
table['Q'] = 24;
table['R'] = 25;
table['S'] = 26;
table['T'] = 27;
table['U'] = 28;
table['V'] = 29;
table['W'] = 32;
table['X'] = 30;
table['Y'] = 31;
table['Z'] = 33;
string input;
int inp[9];
int check_code;
while(cin >> input){
vector<char> capital;
int sum = 0;
for(int i = 0; i < 9; i++){
inp[i] = input[i] - '0';
}
for(int j = 0; j < 8; j++){
sum = sum + inp[j]*(8-j);
}
map<char, int>::iterator iter;
for(iter = table.begin(); iter != table.end(); iter++){
check_code = sum + ((iter->second)/10) + (iter->second)*9;
if (inp[8] != 0){
if (10 - (check_code % 10) == inp[8]){
capital.push_back(iter->first);
}
}
else{ //邊界討論
if (10 - (check_code % 10) == 10){
capital.push_back(iter->first);
}
}
}
for(int k = 0; k < capital.size(); k++){
cout << capital[k];
}
cout << endl;
}
}