spoj#COLONY. Linearian Colony

Linearian Colony

.example-table { text-align: left; margin-top: 10px; width: 100%; } .example-table td { vertical-align: top; } .section { margin-top: 19px; margin-bottom:19px; } .paragraph { text-align: left; margin-top: 10px; margin-bottom: 10px; } .paragraph ul, .paragraph ol { margin-top: 3px; margin-bottom: 3px; }

Description

Linearians are pecurliar creatures. They are odd in several ways:
  1. Every Linearian is either red or blue.
  2. A Linearian colony is a straight line, aligned N-S with the magentic field.
  3. A colony starts with single red Linearian.
  4. Every year, each Linearian produces an offspring of the opposite color. After birth, the parent moves just south of the offspring. (Since everyone is born at once, this does make for a lot of jostling, but everyone stays in order.)
So a colony grows as follows:
N ----------- S

Year 0: R Year 1: BR Year 2: RBBR Year 3: BRRBRBBR Year 4: RBBRBRRBBRRBRBBR

Given a year and a position along the N-S axis, determine what the color of the Linearian there will be.
</p>

Input

The first line is the year Y (0 <= Y <= 51). The second line is the position P from north to south, 0-indexed (0 <= P < 2^Y).

Ouput

The color of the Linearian, either red or blue.
Input Input
3
6
51
123456789012345
Output Output
blue
red