Limits 1s, 512 MB

In a field one summer's day a grasshopper is hopping about and is coding to its heart's content for a single accepted verdict. But the ant is too busy to prepare himself for the winter. The ant always used to say “winter is coming!” "Why bother about winter?" said the grasshopper; "Live on code, dream in code, no winter will touch you."

The code is as follows:

printf("   *\n");
printf("  * *\n");
printf(" *   *\n");
printf("* * * *\n");

And it produces the following output:

   *
  * *
 *   *
* * * *

It’s a triangle. Oh my god! The ant is in love with it. He decided to spend his whole summer with this triangle. He named the above triangle as “level 1 triangle”.

Three level 1 triangles will create a triangle of level 2. (Two level 1 triangle on the basement and the other one on the top of them.)

       *
      * *
     *   *
    * * * *
   *       *
  * *     * *
 *   *   *   *
* * * * * * * *

In the same way a level 3 triangle looks like this:

               *
              * *
             *   *
            * * * *
           *       *
          * *     * *
         *   *   *   *
        * * * * * * * *
       *               *
      * *             * *
     *   *           *   *
    * * * *         * * * *
   *       *       *       *
  * *     * *     * *     * *
 *   *   *   *   *   *   *   *
* * * * * * * * * * * * * * * *

More formally, three level n-1 triangle will create a triangle of level n. (Two level n-1 triangle on the basement and the other triangle on the top of them).

Task: As Mr. Ant is not good at coding task, so he wants you to do a favor. Can you create level n
triangle for him?

Input

The first line contains the number of test cases T (1 ≤ T ≤ 8). Then T lines contains a single integer N (1 ≤ N ≤ 8). You have to print the level n triangle.

Output

For each test case print the desired triangle. Print a blank line between different test cases. Do not print any trailing space.

Sample

InputOutput
2
1
2
   *
  * *
 *   *
* * * *

       *
      * *
     *   *
    * * * *
   *       *
  * *     * *
 *   *   *   *
* * * * * * * *

Observe dotted output format for triangle of level 2 . Here “.” (dot) will be replaced by space and there is no trailing space.

.......*
......*.*
.....*...*
....* * * *
...*.......*
..*.*.....*.*
.*...*...*...*
* * * * * * * *

This problem was authored for Inter Department Programming Contest 2016 at Jahangirnagar University and is being hosted on Toph per author's request.

Submit

Login to submit.

Statistics

80% Solution Ratio
rubabredwanEarliest, Feb '16
nusuBotFastest, 0.0s
NaimulLightest, 1.2 MB
rubabredwanShortest, 2137B
Toph uses cookies. By continuing you agree to our Cookie Policy.