import java.util.Map;
import java.util.TreeMap;

public class LZWDecode {

    private Map codetable;
    private int[] input;
    private StringBuffer result;

    public LZWDecode(int[] input) {
        this.input = input;
        codetable = new TreeMap();
        result = new StringBuffer();
        initCodetable();
        decode();
        System.out.println(result);
    }

    private void initCodetable() {
        for (int i = 0; i < 256; i++) {
            codetable.put(new Integer(codetable.size()),
                    Character.toString((char) i));
        }
    }

    private void decode() {
        String w = (String) codetable.get(new Integer(input[0]));
        result.append(w);
        for (int i = 1; i < input.length; i++) {
            String Cx = (String) codetable.get(new Integer(input[i]));
            if (Cx != null) {
                result.append(Cx);
            } else {
                Cx = w;
                result.append(Cx + Cx.charAt(0));
            }
            codetable.put(new Integer(codetable.size()), w
                    + Character.toString(Cx.charAt(0)));
            w = Cx;
        }
    }
    public static void main(String[] args) {
        new LZWDecode(new int[] { 97, 98, 114, 97, 107, 97, 100,
                256, 258 });
    }
}