#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int d;
    cin>>d;
    for(int h=0;h<d;h++)
    {
        if(h)cout<<endl;
        int n;cin>>n;
        int a[150][150]={};
        for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)a[i][j]=1;
        for(int i=1;i<=n;i++)a[1][i]=a[n][i]=a[i][1]=a[i][n]=0;
        a[2][n]=1;
        int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};
        int x=3,y=n;

        for(int k=0;k<1000;k++)
        {
            while(1)
            {
                int X=x+dx[k%4];
                int Y=y+dy[k%4];
                int s=0;
                for(int j=0;j<4;j++)
                {
                    if(a[X+dx[j]][Y+dy[j]]==0)s++;
                }
                if(s!=1)break;

                a[X][Y]=0;
                x=X;
                y=Y;
            }
        }

        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=n;j++)
            {
                cout<<(a[j][i]?' ':'#');
            }
            cout<<endl;
        }
    }
}
### Prompt

Develop a solution in cpp to the problem described below:

I decided to create a program that displays a "round and round pattern". The "round and round pattern" is as follows.

* If the length of one side is n, it is displayed as a character string with n rows and n columns.
* A spiral pattern that rotates clockwise with the lower left corner as the base point.
* The part with a line is represented by # (half-width sharp), and the blank part is represented by "" (half-width blank).
* Leave a space between the lines.



Create a program that takes an integer n as an input and outputs a "round and round pattern" with a side length of n.



Input

The input is given in the following format:


d
n1
n2
::
nd


The number of datasets d (d ≤ 20) is given to the first line, and the side length ni (1 ≤ ni ≤ 100) of the i-th round pattern is given to each of the following d lines.

Output

Please output a round and round pattern for each data set. Insert a blank line between the datasets.

Example

Input

2
5
6


Output

#####
#   #
# # #
# # #
# ###

######
#    #
# ## #
# #  #
# #  #
# ####

### Response

```cpp
#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int d;
    cin>>d;
    for(int h=0;h<d;h++)
    {
        if(h)cout<<endl;
        int n;cin>>n;
        int a[150][150]={};
        for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)a[i][j]=1;
        for(int i=1;i<=n;i++)a[1][i]=a[n][i]=a[i][1]=a[i][n]=0;
        a[2][n]=1;
        int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};
        int x=3,y=n;

        for(int k=0;k<1000;k++)
        {
            while(1)
            {
                int X=x+dx[k%4];
                int Y=y+dy[k%4];
                int s=0;
                for(int j=0;j<4;j++)
                {
                    if(a[X+dx[j]][Y+dy[j]]==0)s++;
                }
                if(s!=1)break;

                a[X][Y]=0;
                x=X;
                y=Y;
            }
        }

        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=n;j++)
            {
                cout<<(a[j][i]?' ':'#');
            }
            cout<<endl;
        }
    }
}
```