P9022 [CCC 2021 J3] Secret Instructions

Description

Multiple test cases. For each test case, read in $5$ digit characters. - If the sum of the first two digits is odd, output `left`. - If the sum of the first two digits is a non-zero even number, output `right`. - If the sum of the first two digits is zero, output `left` or `right` depending on the previous test case. Then output a space and the last three digit characters.

Input Format

Multiple test cases. Each line contains $5$ digit characters. Read until `99999`.

Output Format

For each line, output one string and $3$ digit characters, separated by a space.

Explanation/Hint

The third character read will not be $0$. The first test case will not start with $00$. Translated from [CCC2021 J3](https://cemc.math.uwaterloo.ca/contests/computing/past_ccc_contests/2021/ccc/juniorEF.pdf). Translated by ChatGPT 5