#C11961. Painting Sequences of Shades

    ID: 41335 Type: Default 1000ms 256MiB

Painting Sequences of Shades

Painting Sequences of Shades

Alex loves to paint landscapes using various shades. He owns n uniquely numbered paint cans (from 1 to n), each containing a distinct shade. Alex wishes to create two sequences from his paint cans:

  • The lexicographically smallest sequence a such that for every \(1 \leq i < n\), \(a_i < a_{i+1}\).
  • The lexicographically largest sequence b such that for every \(1 \leq i b_{i+1}\).

Your task is to help Alex by generating these two sequences given the number of paint cans n.

Note: The term "lexicographically" in this problem refers simply to the natural order of numbers: the smallest sequence is the ascending order of numbers and the largest is the descending order.

inputFormat

The input is read from stdin and consists of:

  • The first line contains an integer \(t\) \((1 \leq t \leq 10^4)\), representing the number of test cases.
  • Each of the following \(t\) lines contains a single integer \(n\) \((1 \leq n \leq 10^5)\) which is the number of paint cans.

It is guaranteed that the sum of \(n\) over all test cases does not exceed \(10^6\).

outputFormat

For each test case, output two lines to stdout:

  • The first line contains \(n\) space-separated integers representing the lexicographically smallest sequence (ascending order).
  • The second line contains \(n\) space-separated integers representing the lexicographically largest sequence (descending order).
## sample
3
5
3
1
1 2 3 4 5

5 4 3 2 1 1 2 3 3 2 1 1 1

</p>