var i,j,n,m: integer;
s:array [1..1000,1..1000] of integer;
Begin
read(n,m);
for i:=1 to n do
begin
for j:=1 to m do
read(s[i,j]);
if s[i,j]=0 then s[i,j]:=1
else if s[i,j]=1 then s[i,j]:=0;
end;
writeln;
write(s[i,j],' ');
End.
var i,j,n,m: integer;
s:array [1..1000,1..1000] of integer;
Begin
read(n,m);
for i:=1 to n do
begin
for j:=1 to m do
begin
read(s[i,j]);
if s[i,j]=0 then s[i,j]:=1
else if s[i,j]=1 then s[i,j]:=0;
end;
end;
writeln;
for i:=1 to n do
begin
writeln;
for j:=1 to m do
write(s[i,j],' ');
end;
End.