SPTTRN3 - Straight Line Spiral Pattern (Act 3)


Print a straight line spiral pattern as shown in the example below. Please use the * (asterisk) and . (dot) characters.

Input

You are given t - the number of test cases and for each of the test cases one integer: s, 3<s<100 - the size of the shape.

Output

For each of the test cases output the requested pattern. Use one line break in between successive patterns.

Example

Input:
5
4
5
11 
13
78

Output:
****
...*
*..*
****

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

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

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

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

hide comments
iwandepe: 2019-10-26 05:28:03

very interesting problem

xog_2: 2018-08-11 19:12:57

3 h, finally done. Very interesting one.

mesakh123: 2017-08-28 11:36:13

use s= 4~23 and 78
just join spiral pattern 1 and 2, add some lines, i used different part for each odd and even lines

Last edit: 2017-08-28 11:37:47
xinnix: 2016-07-08 19:09:32

It's simple. After you do spiral pattern 1 and 2, just use them alternatively. I used recursion on both previous problems so it was very easy. Just had to change 2 characters from previous code.

ruizhang: 2016-06-15 23:15:22

Looks like a question in the IQ test.

supratik101: 2016-05-25 21:12:52

How is this pattern arranged?row wise or column wise?

mauro8707_java: 2016-05-05 07:19:23

I don't see the pattern. how would you guys decribe it?

qbaj: 2015-10-20 12:11:38

You should check for s=7 and s=8.

nevrax: 2015-09-15 12:00:01

I used the text-compare.com to see if my output from ideone.com matches with the output given by the problem above. The result says that @The two texts are identical!@ but I am unable to see the answer so I guess there are more test cases which fail because I can't see them :(


Added by:kuszi
Date:2013-11-02
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64