Pagini recente » Cod sursa (job #1470746) | Cod sursa (job #2170690) | Cod sursa (job #3280929) | Cod sursa (job #804259) | Cod sursa (job #841874)
Cod sursa(job #841874)
program sortaretopologica;
var f,f2:text;
n,m,i,x,y:longint;
a:array [1..50000] of byte;
begin
assign(f,'sortaret.in');
reset(f);
assign(f2,'sortaret.out');
rewrite(f2);
readln(f,n,m);
for i:=1 to m do
begin
readln(f,x,y);
if a[x]=0 then begin write(f2,x,' ');a[x]:=1;end;
if a[y]=0 then begin write(f2,y,' ');a[y]:=1;end;
end;
close(f);
close(f2);
end.