program tura; var i,j,n: integer; a: array[1..100,1..100] of integer; procedure vpered; begin a[i,j]:=1; inc(j); i:=1; end; function mona: boolean; var f: boolean; k: integer; begin f:=true; for k:=1 to j-1 do if a[i,k]=1 then begin f:=false; break end; mona:=f; end; procedure nazad; var t: integer; begin dec(j); if j<1 then halt; for t:=1 to n do if a[t,j]=1 then begin i:=t; a[i,j]:=0; inc(i); end; if i>n then nazad ; end; procedure vivid; var r,b: integer; begin for r:=1 to n do begin for b:=1 to n do write(a[r,b]); writeln; end; writeln; end; begin writeln; writeln; writeln('‚¢¥¤÷âì p®§¬÷p­÷áâì n'); read(n); a[1,1]:=1; i:=1; j:=2; while j>0 do begin if mona then begin vpered; if j>n then vivid end else begin inc(i); if i>n then nazad; end; end; end.