#include <iostream>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

void draw(int n) {
  const static int dx[4] = {1,0,-1,0};
  const static int dy[4] = {0,1,0,-1};
  char M[100][100];
  fill(M[0], M[100], '#');
  if(n != 1) {
    int x = 1, y = n-1;
    int dir = 3;

    M[y][x] = ' ';
    
    while(1) {
      int t;
      for(t = 0; t < 2; t++) {
	int nx = x + dx[dir];
	int ny = y + dy[dir];
	int x2 = x + dx[dir]*2;
	int y2 = y + dy[dir]*2;
	if(nx >= 0 && nx < n && ny >= 0 && ny < n && M[ny][nx] == '#' &&
	   x2 >= 0 && x2 < n && y2 >= 0 && y2 < n && M[y2][x2] == '#') {
	  M[ny][nx] = ' ';
	  x = nx;
	  y = ny;
	  break;
	}
	dir = (dir+1)%4;
      }
      if(t == 2) break;
    }
  }

  rep(i, n) {
    rep(j, n) {
      cout << M[i][j];
    }
    cout << endl;
  }
}

int main() {
  int d;
  cin >> d;
  rep(i, d) {
    int n;
    cin >> n;
    if(i != 0) cout << endl;
    draw(n);
  }
}
### 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 <iostream>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

void draw(int n) {
  const static int dx[4] = {1,0,-1,0};
  const static int dy[4] = {0,1,0,-1};
  char M[100][100];
  fill(M[0], M[100], '#');
  if(n != 1) {
    int x = 1, y = n-1;
    int dir = 3;

    M[y][x] = ' ';
    
    while(1) {
      int t;
      for(t = 0; t < 2; t++) {
	int nx = x + dx[dir];
	int ny = y + dy[dir];
	int x2 = x + dx[dir]*2;
	int y2 = y + dy[dir]*2;
	if(nx >= 0 && nx < n && ny >= 0 && ny < n && M[ny][nx] == '#' &&
	   x2 >= 0 && x2 < n && y2 >= 0 && y2 < n && M[y2][x2] == '#') {
	  M[ny][nx] = ' ';
	  x = nx;
	  y = ny;
	  break;
	}
	dir = (dir+1)%4;
      }
      if(t == 2) break;
    }
  }

  rep(i, n) {
    rep(j, n) {
      cout << M[i][j];
    }
    cout << endl;
  }
}

int main() {
  int d;
  cin >> d;
  rep(i, d) {
    int n;
    cin >> n;
    if(i != 0) cout << endl;
    draw(n);
  }
}
```