#include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;

#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int m;
bool isIn(int x, int y){
    return 0 <= x && x < m && 0 <= y && y < m;
}

int main(){
    int dx[4] = {1, 0, -1, 0};
    int dy[4] = {0, 1, 0, -1};
    bool field[110][110];
    int n;
    cin >> n;
    for(int p=0; p < n; p++){
        if(p != 0) cout << endl;
        cin >> m;
        if(m == 1){cout << "#" << endl; continue;}
        else if(m == 2){cout << "##" << endl; cout << "# " << endl; continue;}
        rep(i, 110)rep(j, 110)field[i][j] = false;
        int x = 0, y = 0, d = 0;
        field[0][0] = true;
        while(true){
            bool change = false;
            while(isIn(x+dx[d], y+dy[d])){
                if(field[x+dx[d]][y+dy[d]]){
                    field[x][y] = false;
                    x -= dx[d]; y -= dy[d];
                    break;
                }
                change = true;
                x += dx[d]; y += dy[d];
                field[x][y] = true;
            }
            if(!change) break;
            d = (d+1)%4;
        }
        if(m%2 == 1){
            x += dx[d]; y += dy[d];
            field[x][y] = true;
        }

        for(int i=m-1; 0 <= i; i--){
            for(int j=0; j < m; j++){
                cout << (field[i][j] ? "#" : " ");
            }
            cout << endl;
        }
    }
}
### Prompt

Your challenge is to write a Cpp solution to the following problem:

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 <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;

#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int m;
bool isIn(int x, int y){
    return 0 <= x && x < m && 0 <= y && y < m;
}

int main(){
    int dx[4] = {1, 0, -1, 0};
    int dy[4] = {0, 1, 0, -1};
    bool field[110][110];
    int n;
    cin >> n;
    for(int p=0; p < n; p++){
        if(p != 0) cout << endl;
        cin >> m;
        if(m == 1){cout << "#" << endl; continue;}
        else if(m == 2){cout << "##" << endl; cout << "# " << endl; continue;}
        rep(i, 110)rep(j, 110)field[i][j] = false;
        int x = 0, y = 0, d = 0;
        field[0][0] = true;
        while(true){
            bool change = false;
            while(isIn(x+dx[d], y+dy[d])){
                if(field[x+dx[d]][y+dy[d]]){
                    field[x][y] = false;
                    x -= dx[d]; y -= dy[d];
                    break;
                }
                change = true;
                x += dx[d]; y += dy[d];
                field[x][y] = true;
            }
            if(!change) break;
            d = (d+1)%4;
        }
        if(m%2 == 1){
            x += dx[d]; y += dy[d];
            field[x][y] = true;
        }

        for(int i=m-1; 0 <= i; i--){
            for(int j=0; j < m; j++){
                cout << (field[i][j] ? "#" : " ");
            }
            cout << endl;
        }
    }
}
```