- Time limit: 1.00 s
- Memory limit: 512 MB
There are chairs arranged in a circle. Each chair is either red or blue. The chairs are numbered ; chairs and are next to each other for all . Here chair refers to chair .
Your task is to find two chairs that have the same color and are next to each other.
To do this, you can ask questions: you can choose a chair and you will be told the color of that chair.
Interaction
This is an interactive problem. Your code will interact with the grader using standard input and output. You should start by reading a single integer : the number of chairs.
On your turn, you can print one of the following:
- "", where : ask the color of chair . The grader will return
R
orB
for red or blue. - "": report that chairs and have the same color. Your program must terminate after this.
Each line should be followed by a line break. You must make sure the output gets flushed after printing each line.
Constraints
- , is odd
- you can ask at most questions of type
Example
5 ? 1 R ? 2 B ? 3 B ! 2