import java.io.*;
import java.util.*;
import java.util.function.*;
import java.util.regex.*;
import java.util.stream.*;

class Leds{

    public enum ACTION {
        LD(Pattern.compile("^\\s*ld ([a-z]),(\\d*)"),
                input -> REG.put(input.get(0), Byte.valueOf(input.get(1)))),
        OUT(Pattern.compile("^\\s*out \\(0\\),([a-z])"),
                input -> {
                    LEDS = REG.get(input.get(0));
                    outputLEDs();
                }),
        RLCA(Pattern.compile("^\\s*rlca"),
                input -> REG.put("a", toByte(Integer.rotateLeft(REG.get("a"), 1)))),
        RRCA(Pattern.compile("^\\s*rrca"),
                input -> {
                    Byte a = (byte) (REG.get("a"));
                    byte rolled = (byte) ((((a & 0xff) >> 1) + ((a & 0x01) == 1 ? 1 << 7 : 0)));
                    REG.put("a", rolled);
                }),
        LABEL(Pattern.compile("^\\s*(.*):"),
                input -> { }),
        DJNZ(Pattern.compile("^\\s*djnz (.*)"),
                input -> {
                    Byte b = REG.get("b");
                    REG.put("b", (byte) (b - 1));
                    if (b > 1) {
                        IntStream.range(0, PROGRAM.size())
                                .filter(index -> (PROGRAM.get(index).action == LABEL && PROGRAM.get(index).params.get(0).equals(input.get(0))))
                                .findFirst()
                                .ifPresent(index -> PC = index);
                    }
                });

        public Pattern pattern;
        public Consumer<List<String>> consumer;

        private ACTION(Pattern pattern, Consumer<List<String>> consumer) {
            this.pattern = pattern;
            this.consumer = consumer;
        }
    }

    public static byte toByte(int num) {
        int tmp = num & 0xff;
        return (byte) ((tmp & 0x80) == 0 ? tmp : tmp - 256);
    }

    public static final HashMap<String, Byte> REG = new HashMap<>();
    public static Byte LEDS = 0x00;
    public static final List<ParsedAction> PROGRAM = new LinkedList<>();
    public static int PC = 0;

    public static Optional<ParsedAction> parseAction(String line) {
        return Arrays.stream(ACTION.values())
                .filter(action -> action.pattern.matcher(line).matches())
                .map(action -> {
                    Matcher m = action.pattern.matcher(line);
                    List<String> params = new ArrayList<>();
                    m.find();

                    return new ParsedAction(action, IntStream.range(1, m.groupCount()+1)
                            .mapToObj(index -> m.group(index))
                            .collect(Collectors.toList())
                    );
                })
                .findFirst();
    }

    public static void outputLEDs() {
        for (int i = 7; i >= 0; i--) {
            System.out.print((LEDS >> i & 0x01) == 1 ? "*" : ".");
        }
        System.out.println();
    }

    public static void main(String[] args) {

        new BufferedReader(new InputStreamReader(System.in)).lines()
                .sequential()
                .map(Leds::parseAction)
                .filter(Optional::isPresent)
                .map(Optional::get)
                .forEachOrdered(action -> PROGRAM.add(action));

        for (PC = 0; PC < PROGRAM.size(); PC++) {
            ParsedAction action = PROGRAM.get(PC);
            action.perform();
        }
    }

    public static class ParsedAction {

        public ACTION action;
        public List<String> params;

        public ParsedAction(ACTION action, List<String> params) {
            this.action = action;
            this.params = params;
        }

        public void perform() {
            action.consumer.accept(params);
        }
    }
}