// Arup Guha
// 6/21/2023
// Solution to SIUCF CP Final Contest Problem: Pokechat
// https://open.kattis.com/problems/pokechat

using namespace std;
#include <bits/stdc++.h>

int main() {

    // uhh, this is silly...
    string code, nums;
    getline(cin, code);
    getline(cin, nums);

    // Just loop through the codes in nums.
    for (int i=0; i<nums.size(); i+=3) {

        // Extract number as string.
        string tmp = nums.substr(i, 3);

        // Convert to number.
        int idx = stoi(tmp);

        // Ta da!
        cout << code[idx-1];
    }

    cout << endl;
    return 0;
}
