#include<iostream>
using namespace std;
#include<math.h>
int sum;
char a[800][800];
void solve(int x,int y,int cou)
{
int m,n;
if(cou==1)
{
a[x][y]='X';
return ;
}
//当前位置
solve(x,y,cou-1);
//右上
m=x;
n=y+(int)pow((double)3, (double)cou-2) * 2;
solve(m,n,cou-1);
//中间位置
m=x+(int)pow((double)3, (double)cou-2);
n=y+(int)pow((double)3, (double)cou-2);
solve(m,n,cou-1);
//左下
m=x+(int)pow((double)3, (double)cou-2)*2;
n=y;
solve(m,n,cou-1);
// cout<<(int)pow((double)3, (double)sum-2)<<" "<<n<<endl;
// system("pause");
// 左下
m=x+(int)pow((double)3, (double)cou-2)*2;
n=y+(int)pow((double)3, (double)cou-2)*2;
solve(m,n,cou-1);
}
int main()
{
while(cin>>sum,sum!=-1)
{
int u=(int)pow((double)3,(double)sum-1);
for(int i=0;i<u;i++)
{
for(int j=0;j<u;j++)
{
a[i][j]=' ';
}
}
solve(0,0,sum);
for(int i=0;i<u;i++)
{
for(int j=0;j<u;j++)
{
cout<<a[i][j];
}
cout<<endl;
}
cout<<'-'<<endl;
}
return 0;
}