Pagini recente » Cod sursa (job #256175) | Cod sursa (job #993854) | Cod sursa (job #1554562) | Cod sursa (job #2002921) | Cod sursa (job #1211268)
var m:array[1..500,1..500] of 0..1;
a:array[1..5000] of longint;
i, j, k, n, t, x, y: longint;
t1:boolean;
procedure st(i:longint);
var j:longint;
begin
for j:=1 to n do
if m[i,j]=1 then
begin
m[i,j]:=0;
dec(a[j]);
end;
end;
begin
assign(input,'sortaret.in');
reset(input);
readln(n,t);
For i:=1 to t do
begin
readln(x,y);
m[x,y]:=1;
inc(a[y]);
end;
close(input);
Assign(output,'sortaret.out');
rewrite(output);
while not t1 do
begin
For i:=1 to n do
begin
t1:=false;
if a[i]=0 then
begin
t1:=true;
write(i,' ');
a[i]:=-1;
st(i);
end;
end;
end;
close(output);
end.