program r;
const n=20;
var mas:array [0..n,0..n] of byte;
i,j,g,m,a,x1,y1,x2,y2,maxx,maxy,minx,miny:integer;
begin
readln (a);
for i:=1 to n do
for j:=1 to m do
mas[i,j]:=0;
for g:=1 to a do
begin
Readln (x1,y1,x2,y2);
if x1>x2 then begin maxX:=x1;minX:=x2;end
else begin maxX:=x2; minX:=x1; end;
if y1>y2 then begin maxY:=y1;minY:=y2;end
else begin maxY:=y2; minY:=y1;end;
m:=0;
for i:=miny+1 to maxy do
for j:=minx+1 to maxx do
if mas[i,j]=0 then begin mas [i,j]:=1;m:=m+1;end;
for i:=1 to n do
begin
for j:=1 to n do
write (mas[i,j]);
writeln;
end;
writeln (m);
end;
end.