See the problem statement here: [http://codeforces.com/contest/921/problem/01](//codeforces.com/contest/921/problem/01).
none
none
p = print

def movedown():
    p("for-99")
    p("move-right")
    p("if-ok break else move-down endif")
    p("end")

def whilecanmove(direction, need_to_take):
    p("for-99")
    p("{}move-{}".format("take " if need_to_take else " ", direction))
    p("if-ok continue else break endif")
    p("end")


p("for-31")

movedown()

p("for-249")
whilecanmove("up", need_to_take=True)
p("open-up")
whilecanmove("up", need_to_take=False)
p("move-right")
whilecanmove("down", need_to_take=True)
p("open-down")
whilecanmove("down", need_to_take=False)
p("move-right")
p("end")

whilecanmove("up", need_to_take=True)
p("open-up")
whilecanmove("up", need_to_take=True)

p("for-249")
whilecanmove("down", need_to_take=False)
p("move-left")
whilecanmove("up", need_to_take=False)
p("move-left")
p("end")

whilecanmove("down", need_to_take=False)
p("move-left move-down")

p("end")  # for-31

p("for-117 move-down end")

p("for-438 move-right end")
p("for-61 open-right move-right end")
