QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 64 MB Total points: 100

#23720. JOI Poster

Statistics

The Japanese Committee for the Olympiad in Informatics has decided to make a poster to promote this year's training camp of the Japanese Olympiad in Informatics (JOI). A poster with a motif of the JOI logo was created.

The JOI Logo

On the poster, $2^N \times 2^N$ letters are printed in the shape of a square.

When $N \ge 1$, the $2^N \times 2^N$ square is divided into $4$ squares of size $2^{N-1} \times 2^{N-1}$. The letter J is printed in the top-left square, the letter O is printed in the top-right square, and the letter I is printed in the bottom-left square. Furthermore, a poster of size $2^{N-1} \times 2^{N-1}$ is printed in the bottom-right square. When $N = 0$, a poster of size $1 \times 1$ consisting of a single letter J is printed.

Below, the letters printed on a poster of size $8 \times 8$ when $N = 3$ are shown.

JJJJOOOO
JJJJOOOO
JJJJOOOO
JJJJOOOO
IIIIJJOO
IIIIJJOO
IIIIIIJO
IIIIIIIJ
The poster for $N = 3$

A printing error was found on the $K$-th row of the completed poster.

This year's training camp of the Japanese Olympiad in Informatics has already started. There is not enough time to ask the printing company to print the poster again. Therefore, it was decided to deal with the problem by pasting the correct $K$-th row onto the poster.

Task

Write a program which, given integers $N$ and $K$ as input, outputs the $K$-th row of the poster of size $2^N \times 2^N$.

Constraints

  • $0 \le N \le 20$: The size of the poster
  • $1 \le K \le 2^N$: The row of the poster to output

Input

Read the following from the standard input. The input consists of a single line containing the integer $N$, representing the size of the poster, and the integer $K$, representing the row to output, separated by a space.

Output

Output a single line to the standard output containing the $K$-th row of the poster of size $2^N \times 2^N$.

Grading

In test groups worth $50$ points, $N$ is at most $10$.

Samples

Input 1

1 1

Output 1

JO

Input 2

2 4

Output 2

IIIJ

Input 3

3 7

Output 3

IIIIIIJO

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.