Нашел код на паскале, но так как его не изучал ничего не понял. Помогите перевести код в питон 3, чтобы я хоть как-то смог разобраться.
var
inp, outp: text;
n, m, x, y, col, i, j: integer;
relations: array[1..100, 1..100] of integer;
used: array[1..100] of boolean;
ability: boolean;
color: array[1..100] of integer;
procedure DFS(v: integer);
var
j: integer;
begin
used[v] := false;
color[v] := col;
col := col * (-1);
for j := 1 to n do
if (relations[v, j] <> 0) and used[j] then DFS(j);
end;
begin
assign(inp, inpFileName);
assign(outp, outpFileName);
reset(inp);
rewrite(outp);
read(inp, n, m);
for i := 1 to n do
for j := 1 to n do
relations[i, j] := 0;
for i := 1 to m do
begin
read(inp, x, y);
relations[x, y] := 1;
relations[y, x] := 1;
end;
for i := 1 to m do
used[i] := true;
col := 1;
for i := 1 to n do
color[i] := 0;
DFS(x);
ability := true;
for i := 1 to n do
for j := 1 to n do
if (color[i] = color[j]) and (relations[i, j] <> 0) then ability := false;
if ability then
begin
writeln(outp, 'YES');
for i := 1 to n do
if color[i] = 1 then writeln(outp, i);
end
else writeln(outp, 'NO');
close(inp);
close(outp);
end.