#include <iostream>
using namespace std;
int main()
{
int n; cin >> n;
int a=0;
while (a < n)
{
cout << "*";
a++;
}
cout <<"\n";
int i = 0;
while (i < n-2){
a = 1;
while (a <= n)
{
if (a == 1 || a == n)
{
cout << "*";
}
else
{
cout <<" ";
}
a++;
}
cout <<"\n";
i++;
}
a = 0;
while (a < n)
{
cout << "*";
a++;
}
return 0;
}