/*
POJ 2083
简单递归
即输出图形
X
-
X X
X
X X
-
X X X X
X X
X X X X
X X
X
X X
X X X X
X X
X X X X
-
X X X X X X X X
X X X X
X X X X X X X X
X X X X
X X
X X X X
X X X X X X X X
X X X X
X X X X X X X X
X X X X
X X
X X X X
X X
X
X X
X X X X
X X
X X X X
X X X X X X X X
X X X X
X X X X X X X X
X X X X
X X
X X X X
X X X X X X X X
X X X X
X X X X X X X X
-
*/
#include<iostream>
using namespace std;
bool map[730][730];
//print()函数并不绘制图形,而是根据坐标改变map[x][y]的值
int muti[] = {1,3,9,27,81,243,729};//3的N次幂表
void print(int x,int y,int cur){
if(cur==1){
map[x][y] = true;
return ;
}
//递归绘制左上角的图形
print(x,y,cur-1);
print(x,y+2*muti[cur-2],cur-1);
//递归绘制右上角的图形
print(x+muti[cur-2],y+muti[cur-2],cur-1);
//递归绘制中间的图形
print(x+2*muti[cur-2],y,cur-1);
//递归绘制左下角的图形
print(x+2*muti[cur-2],y+2*muti[cur-2],cur-1);
//递归绘制右下角的图形
}
int main(){
int n;
while(cin>>n&&n!=-1){
memset(map,false,sizeof(map));
print(1,1,n);
for(int i=1;i<=muti[n-1];i++){
for(int j=1;j<=muti[n-1];j++){
if(map[i][j])cout<<"X";
else cout<<" ";
}
cout<<endl;
}
cout<<"-"<<endl;
}
return 0;
}