#K5591. Beaver Sequence Generation

    ID: 30080 Type: Default 1000ms 256MiB

Beaver Sequence Generation

Beaver Sequence Generation

You are given a positive integer ( n ). Your task is to generate a sequence of digits of length ( n ) according to the following rules:

  • If \( n = 1 \), output the single digit 5.
  • If \( n \ge 2 \), construct the sequence by appending digits such that the digit at the \( i^{th} \) position (0-indexed) is 1 if \( i \) is even and 2 if \( i \) is odd. In other words, the sequence will be of the form 1 2 1 2 ....

For example, when ( n = 4 ), the output should be 1212; when ( n = 5 ), the output should be 12121.

Additionally, the problem supports multiple test cases. The input starts with an integer ( T ) (the number of test cases), followed by ( T ) lines each containing a single integer ( n ). For each test case, print the corresponding sequence on a new line.

Note: Although the problem description mentions balancing sums in even and odd positions, follow the sample outputs as specified.

inputFormat

The input is given from stdin and consists of multiple lines:

  1. The first line contains an integer \( T \) denoting the number of test cases.
  2. The next \( T \) lines each contain an integer \( n \) representing the length of the sequence to be generated.

For example:

3
1
4
5

outputFormat

For each test case, output the generated sequence on a separate line to stdout.

For the sample input above, the expected output is:

5
1212
12121
## sample
1
1
5

</p>