#include<iostream>
#include<cstring>

using namespace std;

const int MAX = 101;
char data[MAX][MAX];
int n;
int dx[4] = {0,1,0,-1};
int dy[4] = {-1,0,1,0};
 
void print(){
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++)
      cout << data[i][j];
    cout << endl;
  }
}

bool movable(int d, int x, int y){
  return data[y+dy[d]][x+dx[d]] == ' ';
}

void solve(){

  int x = 2,y = n-1;
  int d = 0;

  for(int i = 0; i < n; i++)
    data[0][i] = data[n-1][i] = data[i][0] = data[i][n-1] = '#';

  data[n-1][1] = ' ';

  if(n == 4) return;

  while(1){
    int num = 0;

    while(1){
      x += dx[d];
      y += dy[d];
      if(movable(d,x,y)){
	num++;
	data[y][x] = '#';
      }else{
	x -= dx[d];
	y -= dy[d];
	break;
      }
    }
    if(num < 2) break;
    d++;
    d%=4;
  }
}

void init(){
  memset(data,' ',sizeof(data));
}

int main(){

  bool line = false;
  int x;
  cin >> x;
  
  while(x--){
    if(line) cout << endl;
    line = true;
    init();
    cin >> n;
    solve();
    print();
  }
  return 0;
}
### Prompt

In cpp, your task is to solve 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<cstring>

using namespace std;

const int MAX = 101;
char data[MAX][MAX];
int n;
int dx[4] = {0,1,0,-1};
int dy[4] = {-1,0,1,0};
 
void print(){
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++)
      cout << data[i][j];
    cout << endl;
  }
}

bool movable(int d, int x, int y){
  return data[y+dy[d]][x+dx[d]] == ' ';
}

void solve(){

  int x = 2,y = n-1;
  int d = 0;

  for(int i = 0; i < n; i++)
    data[0][i] = data[n-1][i] = data[i][0] = data[i][n-1] = '#';

  data[n-1][1] = ' ';

  if(n == 4) return;

  while(1){
    int num = 0;

    while(1){
      x += dx[d];
      y += dy[d];
      if(movable(d,x,y)){
	num++;
	data[y][x] = '#';
      }else{
	x -= dx[d];
	y -= dy[d];
	break;
      }
    }
    if(num < 2) break;
    d++;
    d%=4;
  }
}

void init(){
  memset(data,' ',sizeof(data));
}

int main(){

  bool line = false;
  int x;
  cin >> x;
  
  while(x--){
    if(line) cout << endl;
    line = true;
    init();
    cin >> n;
    solve();
    print();
  }
  return 0;
}
```