last_direction = None while True: instruction = input() if instruction == "99999": break direction = int(instruction[0]) + int(instruction[1]) amount = int(instruction[2:]) if amount == 0: direction = last_direction if direction % 2 == 0: print("right", amount) else: print("left", amount) last_direction = direction