CF1266A.Competitive Programmer

传统题 时间 2000 ms 内存 256 MiB 5 尝试 1 已通过 1 标签

Competitive Programmer

Bob is a competitive programmer. He wants to become red, and for that he needs a strict training regime. He went to the annual meeting of grandmasters and asked nn of them how much effort they needed to reach red.

"Oh, I just spent xix_i hours solving problems", said the ii-th of them.

Bob wants to train his math skills, so for each answer he wrote down the number of minutes (60xi60 \cdot x_i), thanked the grandmasters and went home. Bob could write numbers with leading zeroes — for example, if some grandmaster answered that he had spent 22 hours, Bob could write 000120000120 instead of 120120.

Alice wanted to tease Bob and so she took the numbers Bob wrote down, and for each of them she did one of the following independently:

  • rearranged its digits, or
  • wrote a random number.

This way, Alice generated nn numbers, denoted y1y_1, ..., yny_n.

For each of the numbers, help Bob determine whether yiy_i can be a permutation of a number divisible by 6060 (possibly with leading zeroes).

Input

The first line contains a single integer nn (1n4181 \leq n \leq 418) — the number of grandmasters Bob asked.

Then nn lines follow, the ii-th of which contains a single integer yiy_i — the number that Alice wrote down.

Each of these numbers has between 22 and 100100 digits '0' through '9'. They can contain leading zeroes.

Output

Output nn lines.

For each ii, output the following. If it is possible to rearrange the digits of yiy_i such that the resulting number is divisible by 6060, output "red" (quotes for clarity). Otherwise, output "cyan".

Note

In the first example, there is one rearrangement that yields a number divisible by 6060, and that is 360360.

In the second example, there are two solutions. One is 060060 and the second is 600600.

In the third example, there are 66 possible rearrangments: 025025, 052052, 205205, 250250, 502502, 520520. None of these numbers is divisible by 6060.

In the fourth example, there are 33 rearrangements: 228228, 282282, 822822.

In the fifth example, none of the 2424 rearrangements result in a number divisible by 6060.

In the sixth example, note that 0000000\dots0 is a valid solution.

Samples

6
603
006
205
228
1053
0000000000000000000000000000000000000000000000
red
red
cyan
cyan
cyan
red

在线编程 IDE

建议全屏模式获得最佳体验