class StackingBlocks{
public static void main
(String[] args
){ s(1);
s(2);
s(3);
s(5);
}
static void s
(int q
){int i,j,x,z
;char b
;for(i
=0;i
<q
*q
+1;i
++){z
=0;x
=0;for(j
=0;j
<(q
*(q
+1))/2+1;j
++){b
=' ';if(x
==z
){int y
=x
+1;if((q
*q
+1-i
<=x
*x
+1&&(q
*q
+1-i
)%(x
==0?1:x
)==(x
==1?0:1))||(y
<=q
&&q
*q
+1-i
<=y
*y
+1&&(q
*q
+1-i
)%(y
==0?1:y
)==(y
==1?0:1)))b
='+';else if(q
*q
+1-i
<=x
*x
+1||y
<=q
&&q
*q
+1-i
<=y
*y
+1)b
='|';x
++;z
=1;}else{if(q
*q
+1-i
<=x
*x
+1&&(q
*q
+1-i
)%(x
==0?1:x
)==(x
==1?0:1))b
='-';z
++;}System.
out.
print(b
);}System.
out.
println();}} }
Y2xhc3MgU3RhY2tpbmdCbG9ja3N7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmdbXSBhcmdzKXsKCQlTeXN0ZW0ub3V0LnByaW50bG4oIjEgPT4iKTsKCQlzKDEpOwoJCVN5c3RlbS5vdXQucHJpbnRsbigiMiA9PiIpOwoJCXMoMik7CgkJU3lzdGVtLm91dC5wcmludGxuKCIzID0+Iik7CgkJcygzKTsKCQlTeXN0ZW0ub3V0LnByaW50bG4oIjUgPT4iKTsKCQlzKDUpOwoJfQogICAgc3RhdGljIHZvaWQgcyhpbnQgcSl7aW50IGksaix4LHo7Y2hhciBiO2ZvcihpPTA7aTxxKnErMTtpKyspe3o9MDt4PTA7Zm9yKGo9MDtqPChxKihxKzEpKS8yKzE7aisrKXtiPScgJztpZih4PT16KXtpbnQgeT14KzE7aWYoKHEqcSsxLWk8PXgqeCsxJiYocSpxKzEtaSklKHg9PTA/MTp4KT09KHg9PTE/MDoxKSl8fCh5PD1xJiZxKnErMS1pPD15KnkrMSYmKHEqcSsxLWkpJSh5PT0wPzE6eSk9PSh5PT0xPzA6MSkpKWI9Jys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