C. Can You BELIEVE it?
time limit per test
2 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output

At Britain's Got Talent 2026, Rafferty wants to perform a card trick using a deck of $$$n$$$ cards in a predetermined order.

Each card has:

  • a face-up number from $$$1$$$ to $$$13$$$,
  • a face-down handwritten letter, which is one of B, E, L, I, V.

The trick begins with all cards in the deck face-up.

  1. The audience member chooses an index $$$i$$$ ($$$1 \le i \le n-6$$$), discards the first $$$i-1$$$ cards, and keeps the next $$$7$$$ cards, namely positions $$$i,i+1,\dots,i+6$$$.
  2. These $$$7$$$ cards are then arranged in increasing order of their face-up numbers.
After that, Rafferty turns them over. The letters on their face-down sides must read
BELIEVE

from left to right.

Final result of the trick$$$^{1}$$$. The face-down letters of the cards at positions $$$i$$$ to $$$i+6$$$ spell BELIEVE when arranged in ascending order of face-up numbers. The BGT crowd goes wild — somehow, this is inspirational.

In other words, for the chosen window of $$$7$$$ cards:

  • after sorting the cards by face-up number in increasing order,
  • the corresponding face-down letters must be B, E, L, I, E, V, E.
  • all face-up numbers must be distinct. Otherwise, cards with equal numbers could be reordered arbitrarily, which may destroy the word BELIEVE.

Your task is to construct the entire deck so that this works for every valid choice of $$$i$$$ ($$$1\leq i \leq n-6$$$).

$$$^{1}$$$ Watch the trick at https://www.youtube.com/watch?v=BCHkMexXu40&t=6m14s.

Input

The input consists of a single line containing an integer $$$n$$$ ($$$n=7$$$ or $$$n=52$$$), the number of cards in the deck. There are exactly 2 tests for this problem. The sample has $$$n = 7$$$ and one hidden test case has $$$n=52$$$.

Output

Output 2 lines:

  • On the first line, output $$$n$$$ space-separated integers $$$c_1,c_2,\dots,c_n$$$ ($$$1 \le c_i \le 13$$$), where $$$c_i$$$ is the face-up number of the $$$i$$$-th card.
  • On the second line, output $$$n$$$ space-separated uppercase characters, where the $$$i$$$-th letter is the face-down letter of the $$$i$$$-th card.

Your output must satisfy all of the following:

  • Each face-down letter must be one of B, E, L, I, V.
  • Each face-up number from $$$1$$$ to $$$13$$$ appears at most $$$4$$$ times.
  • In every contiguous segment of $$$7$$$ cards, all face-up numbers are distinct.
  • For every $$$i$$$ with $$$1 \le i \le n-6$$$, when the cards at positions $$$i$$$ to $$$i+6$$$ are sorted by face-up number, their face-down letters form BELIEVE.
The constraints are chosen to resemble a standard deck of cards. Ignoring jokers, a standard deck has 4 suits, and each suit contains $$$13$$$ ranks: Ace, ranks $$$2$$$ to $$$10$$$, Jack, Queen and King. In this problem, we represent these $$$13$$$ ranks using the face-up numbers from $$$1$$$ to $$$13$$$. Hence, there are $$$52$$$ cards in total, and each face-up number from $$$1$$$ to $$$13$$$ may appear at most 4 times.
Example
Input
7
Output
7 5 4 3 2 1 6
E E I L E B V
Note

The sample is only meant to illustrate the output format.

For $$$n=7$$$, the only valid choice is $$$i=1$$$. Sorting the $$$7$$$ cards by face-up number gives the numbers

$$$$$$ 1,2,3,4,5,6,7 $$$$$$

with corresponding letters

$$$$$$ \texttt{B},\texttt{E},\texttt{L},\texttt{I},\texttt{E},\texttt{V},\texttt{E} $$$$$$

so the word BELIEVE is formed.

Since there are only two possible inputs, you may output this exact construction for $$$n=7$$$ and focus on your construction for $$$n=52$$$.