var x,i,j,sum,n:int64;
begin
read(n);
for i:=1 to n do begin
for j:=1 to n do begin
read(x);
if i+j>n+1 then begin
inc(sum,x);
end;
end;
end;
if (sum mod 2)=0 then begin
sum:=sum div 2;
if (sum mod 2)=0 then writeln('YES')
else writeln('NO');
end
else writeln('NO');
end.