#include <iostream>
using namespace std;
int main() {
int h;
while (cin >>h) { // 注意 while 处理多个 case
for(int i=1;i<=3*h;i++) //i:所处行数
{ int t=i/3+1; //该行位于第几层,如果是3的倍数行在后面t再额外-1
if(i%3==1) //层内第一行
{
for(int j=1;j<=3*h-i;j++) //先输出第一个星号
cout<<" ";
cout<<"*";
for(int tr=t-1;tr>0;tr--) //位于第t层,t-1就是还剩几个*要输出
{
for(int lf=1;lf<=5;lf++) //层内第一行需要每隔五个空格输出一个星号
{
cout<<" ";
}
cout<<"*";
}
cout<<endl;//层内第一行结束时输出换行
}
if(i%3==2) //层内第二行
{
for(int j=1;j<=3*h-i;j++) //先输出第一个二连星号
cout<<" ";
cout<<"* *";
for(int tr=t-1;tr>0;tr--) //还剩t-1个二连星号
{
for(int lf=1;lf<=3;lf++) //层内第二行每间隔三个空格输出一个二连星号
{
cout<<" ";
}
cout<<"* *";
}
cout<<endl;
}
if(i%3==0)
{
for(int j=1;j<=3*h-i;j++)
cout<<" ";
cout<<"* * *";
for(int tr=t-2;tr>0;tr--) //同理,但是注意t-2才是剩余的三连星号数量
{
for(int lf=1;lf<=1;lf++)
{
cout<<" ";
}
cout<<"* * *";
}
cout<<endl;
}
}
for(int ll=1;ll<=h-1;ll++) //尾巴,但不输出最后一行
{
for(int rl=1;rl<=3*h-1;rl++)
cout<<" ";
cout<<"*"<<endl;
}
for(int rl=1;rl<=3*h-1;rl++)//最后一行的尾巴单独输出,不加endl
cout<<" ";
cout<<"*";
}
}
// 64 位输出请用 printf("%lld")