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

bool pat[104][104];
int dx[4] = {0, 1, 0, -1};
int dy[4] = {-1, 0, 1, 0};

int main() {
    int n, m;
    cin >> n;
    bool lf = false;
    while (n--) {
        cin >> m;
        for (int i=0; i<=m+3; ++i) {
            for (int j=0; j<=m+3; ++j) {
                pat[i][j] = (i == 0 || i == m+3 || j == 0 || j == m+3);
            }
        }
        int x = 2;
        int y = m+1;
        int k = 0;
        while (1) {
            pat[y][x] = true;
            if (pat[y + dy[k] * 2][x + dx[k] * 2]) {
                k = (k + 1) % 4;
            }
            int adj = 0;
            for (int i=0; i<4; ++i) {
                if (pat[y + dy[k] + dy[i]][x + dx[k] + dx[i]]) {
                    adj ++;
                }
            }
            if (1 < adj) {
                break;
            }
            x += dx[k];
            y += dy[k];
        }
        if (lf) {
            cout << endl;
        }
        for (int i=2; i<=m+1; ++i) {
            for (int j=2; j<=m+1; ++j) {
                cout << (pat[i][j] ? "#" : " ");
            }
            cout << endl;
        }
        lf = true;
    }
    return 0;
}
### Prompt

Generate 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 <iostream>
#include <string>
#include <vector>
using namespace std;

bool pat[104][104];
int dx[4] = {0, 1, 0, -1};
int dy[4] = {-1, 0, 1, 0};

int main() {
    int n, m;
    cin >> n;
    bool lf = false;
    while (n--) {
        cin >> m;
        for (int i=0; i<=m+3; ++i) {
            for (int j=0; j<=m+3; ++j) {
                pat[i][j] = (i == 0 || i == m+3 || j == 0 || j == m+3);
            }
        }
        int x = 2;
        int y = m+1;
        int k = 0;
        while (1) {
            pat[y][x] = true;
            if (pat[y + dy[k] * 2][x + dx[k] * 2]) {
                k = (k + 1) % 4;
            }
            int adj = 0;
            for (int i=0; i<4; ++i) {
                if (pat[y + dy[k] + dy[i]][x + dx[k] + dx[i]]) {
                    adj ++;
                }
            }
            if (1 < adj) {
                break;
            }
            x += dx[k];
            y += dy[k];
        }
        if (lf) {
            cout << endl;
        }
        for (int i=2; i<=m+1; ++i) {
            for (int j=2; j<=m+1; ++j) {
                cout << (pat[i][j] ? "#" : " ");
            }
            cout << endl;
        }
        lf = true;
    }
    return 0;
}
```