if wall_from_up() and wall_from_right() and free_from_down():
move_down()
move_up()
elif wall_from_down() and wall_from_right() and wall_from_left():
move_up()
move_up()
move_up()
move_up()
elif wall_from_up() and wall_from_left() and free_from_right():
move_right()
move_right()
move_up()
move_up()
elif wall_from_up() and free_from_right():
move_left()
move_up()
move_up()
elif free_from_right() and free_from_up():
move_up()
if wall_from_right() and wall_from_left():
move_up()
elif wall_from_right() and wall_from_up():
move_left()
move_left()
move_up()
move_up()
elif free_from_down() and free_from_up():
move_up()
if free_from_right():
move_up()
move_up()
elif free_from_up() and free_from_down() and wall_from_right():
move_up()
move_up()
move_up()