## Editorial for SAC '22 Code Challenge 5 P2 - Querying Extensions

Remember to use this editorial

**only**when stuck, and**not to copy-paste code from it**. Please be respectful to the problem author and editorialist.**Submitting an official solution before solving the problem yourself is a bannable offence.**Author:

##### Subtask 1

It suffices to hard code the output for every and `left`

or `right`

.

**Time Complexity:**

##### Subtask 2

Realize that this is a parity problem:

- If , then the output is the same as the original swaying direction.
- Otherwise, if , then the output is the opposite of the original swaying direction.

Output the direction based on the two cases.

**Time Complexity:**

## Comments