program pil_9_30(input, output);
const n=10;
var m:array[1..n,1..n] of integer;
    i, j, k, s : integer;
    result : boolean;
begin
     for i:=1 to n do
     begin
         for j:=1 to n do
             read(m[i,j]);
     end;
     result := true;
     i := 1;
     while (i<n) and (result) do
     begin
          k := i + 1;
          s := 0;
          for j:=1 to n do s := s + sqr(m[i,j]);
          if s<>1 then result := false;
          while (k<=n) and (result) do
          begin
               s := 0;
               for j := 1 to n do s := s+m[i,j] * m[k,j];
               if s<>0 then result := false;
               k:=k+1;
          end;
          i:=i+1;
     end;
     write(result);
end.