while 1:i=n=input();exec"a=i/n%4;i+=1;t=a>i%n<1;b=' _'[t]*n;print' | '[a]+b+'|'+b*(a/3|t)+a/3*'|';"*n*4