#!/usr/bin/python

import sys

field = ['p','m','x','w','wp','ms','xs','s'];

instr = [
  'if b[%s] = 0',
  'if a >= c[%s]',
  'b -> c[%s]',
  '0 -> c[%s]',
  'shift left a[%s]',
  'a - c -> c[%s]',
  'c -> a[%s]',
  'a + c -> c[%s]',
  'if a >= b[%s]',
  'shift right c[%s]',
  'shift right b[%s]',
  'shift right a[%s]',
  'a - b -> a[%s]',
  'a - c -> a[%s]',
  'a + b -> a[%s]',
  'a + c -> a[%s]',
  '0 -> b[%s]',
  'if c[%s] >= 1',
  '0 - c -> c[%s]',
  '0 - c - 1 -> c[%s]',
  'a -> b[%s]',
  'c - 1 -> c[%s]',
  'if c[%s] = 0',
  'c + 1 -> c[%s]',
  'b exchange c[%s]',
  'if a[%s] >= 1',
  'c + c -> c[%s]',
  '0 -> a[%s]',
  'a exchange b[%s]',
  'a - 1 -> a[%s]',
  'a exchange c[%s]',
  'a + 1 -> a[%s]',
]

misc0 = [
  'no operation',
  'buffer -> rom address',
  'memory insert',
  '',
  'mark and search',
  '',
  'memory delete',
  '',
  'rom address -> buffer',
  '',
  'search for label',
  '',
  'pointer advance',
  '',
  '',
  ''
]

misc10 = [
  'display toggle',
  'c exchange m',
  'c -> stack',
  'stack -> a',
  'display off',
  'm -> c',
  'down rotate',
  'clear registers'
]

def special(arg,opcode):
  if (opcode==0):
    if (arg in [0,1,2,4,6,8,10,12]):
      return misc0[arg]
    else:
      return '*** illegal [%d,%d] ***' % (arg,opcode)
  elif (opcode==1):
    if (arg<12):
      return '1 -> s%d' % arg
    else:
      return '*** illegal [%d,%d] ***' % (arg,opcode)
  elif (opcode==3):
    return '%d -> p' % arg
  elif (opcode==4):
    if (arg==3):
      return 'keys -> rom address'
    elif ((arg%2)==0):
      return 'select rom %d' % (arg/2)
    else:
      return '*** illegal [%d,%d] ***' % (arg,opcode)
  elif (opcode==5):
    if (arg<12):
      return 'if s%d = 0' % arg
    else:
      return '*** illegal [%d,%d] ***' % (arg,opcode)
  elif (opcode==6):
    if (arg<10):
      return 'load constant %d' % arg
    else:
      return '*** illegal [%d,%d] ***' % (arg,opcode)
  elif (opcode==7):
    if (arg==0):
      return 'p - 1 -> p'
    else:
      return '*** illegal [%d,%d] ***' % (arg,opcode)
  elif (opcode==9):
    if (arg<12):
      return '0 -> s%d' % arg
    else:
      return '*** illegal [%d,%d] ***' % (arg,opcode)
  elif (opcode==10):
    if ((arg%2)==1):
      return '*** illegal [%d,%d] ***' % (arg,opcode)
    else:
      return misc10[arg/2]
  elif (opcode==11):
    return 'if p # %d' % arg
  elif (opcode==12):
    if (arg==0):
      return 'return'
    elif (opcode==9):
      return 'c -> data address'
    elif (opcode==11):
      return 'c -> data'
    else:
      return '*** illegal [%d,%d] ***' % (arg,opcode)
  elif (opcode==13):
    if (arg==0):
      return 'clear status'
    elif (arg==8):
      return 'delayed select group 0'
    elif (arg==10):
      return 'delayed select group 1'
    elif ((arg%2)==1):
      return 'delayed select rom %d' % ((arg-1)/2)
    else:
      return '*** illegal [%d,%d] ***' % (arg,opcode)
  elif (opcode==14):
    if (arg==11):
      return 'data -> c'
    else:
      return '*** illegal [%d,%d] ***' % (arg,opcode)
  elif (opcode==15):
    if (arg==0):
      return 'p + 1 -> p'
    else:
      return '*** illegal [%d,%d] ***' % (arg,opcode)
  else:
    return '*** illegal [%d,%d] ***' % (arg,opcode)

def e_binary(x):
  s = ""
  for i in range(0,10):
    if (x&1)==1:
      c = '1'
    else:
      c = '0'
    s = c + s
    x = x/2
  return s

def d_binary(x):
  val = 0
  for i in range(0,8):
    if (x[i]=='1'):
      val = val + (1<<(7-i))
  return val

def e_octal(x):
  return '%03o' % x

for x in sys.stdin.readlines():
  n = eval('0'+x[5:9])
  x = e_binary(n)
  n = d_binary(x[0:8])
  if (x[8:10]=='11'):
    print '\t' + 'go to @' + e_octal(d_binary(x[0:8]))
  elif (x[8:10]=='01'):
    print '\t' + 'jsb @' + e_octal(d_binary(x[0:8]))
  elif (x[8:10]=='10'):
    f = n/8
    print '\t' + (instr[16*(f&1)+(f/2)] % field[n%8])
  else:
    print '\t' + special(n/16,n%16)

