for i in[0]*7:n=input();exec"x=' _'[i%n+2>n+i/3/n]*n;print(' | '[i/n]+x+'|'+x+' | '[i/n]).rstrip();i+=1;"*4*n