#include <stdio.h>

int main() {

    int n;

    while (scanf("%d", &n) != EOF) 
    {
        int i = 0;

        for (i = 1; i <= n; i++)//第一行
        {
            printf("* ");
        }

        printf("\n");

        int k = 0;
        for (k = 1; k <= n - 2; k++)//中间行数
        {
            printf("* ");

            int l = 0;
            for (l = 1; l <= n - 2; l++)
            {
                printf("  ");
            }

            printf("* ");
            printf("\n");
        }

        int j = 0;
        for (j = 1; j <= n; j++)//最下面一行
        {
            printf("* ");
        }

        printf("\n");
    }

    return 0;
}