#include <stdio.h>

int main() { int x = 0; int i = 0; int j = 0; char ch[20][20] = {0};

while (scanf("%d", &x) != EOF)
{
    for (i=0; i<x; i++)
    {
        for (j=0; j<x; j++)
            ch[i][j] = ' ';
    }
    
    for (i=0; i<x; i++)
    {
        ch[0][i] = '*';
        ch[x-1][i] = '*';
        ch[i][0] = '*';
        ch[i][x-1] = '*';
    }
    
    for (i=0; i<x; i++)
    {
        for (j=0; j<x; j++)
            printf("%c ", ch[i][j]);
        printf("\n");
    }
}
return 0;

}