#!/usr/bin/python

import sys

from . import encoding


def main(args):
    while True:
        line = sys.stdin.read(5).strip()
        if not line:
            break
        try:
            words = int(line, 16)
            opcode = str(encoding.decode(words))
            opcode = opcode.replace("\t", " ")
        except ValueError:
            opcode = "!%s" % line
        sys.stdout.write(opcode + "\n")
        sys.stdout.flush()


if __name__ == "__main__":
    sys.exit(main(sys.argv[1:]))
