#include<stdio.h>
int main()
{
int n = 0;
while (scanf("%d", &n) != EOF)
{
for (int i = 0; i < n; i++)
{
if (i == 0||i==n-1)
{
for (int j = 0; j < n; j++)//第一行打印
{
printf("* ");
}
printf("\n");
}
else
{
for (int j = 0; j < n; j++)
{
if (j == 0 || j == n - 1)//第2--n-1行打印
{
printf("* ");
}
else
{
printf(" ");
}
}
printf("\n");
}
}
}
return 0;
}
int main()
{
int n = 0;
while (scanf("%d", &n) != EOF)
{
for (int i = 0; i < n; i++)
{
if (i == 0||i==n-1)
{
for (int j = 0; j < n; j++)//第一行打印
{
printf("* ");
}
printf("\n");
}
else
{
for (int j = 0; j < n; j++)
{
if (j == 0 || j == n - 1)//第2--n-1行打印
{
printf("* ");
}
else
{
printf(" ");
}
}
printf("\n");
}
}
}
return 0;
}