{
TASK:platka
LANG:PASCAL
}
program platka;
var
{  f:text;}
  can:boolean;
  n,m,i,j,a,b,top1,top2,cur,save:longint;
  mas1,mas2:array[1..100000] of integer;
  graph:array[1..1500,1..1500] of boolean;
  added:array[1..1500,1..1500] of boolean;
begin
{   assign(f,'platka.in');
   reset(f);}
   readln({f,}n,m);
   a:=0;
   b:=0;
   for i:=1 to m do
   begin
    readln({f,}a,b);
    graph[a,b]:=true;
    graph[b,a]:=true;
   end;
   top1:=1;
   top2:=0;
   mas1[top1]:=1;
   while true do
   begin
    if top1=0 then break;
    cur:=mas1[top1];
    can:=false;
    save:=0;
    for j:=1 to n do
     if (graph[cur,j]) and (not added[cur,j]) then
     begin
      can:=true;
      save:=j;
      added[cur,j]:=true;
      added[j,cur]:=true;
      break;
     end;
     if can=true then
     begin
      top1:=top1+1;
      mas1[top1]:=save;
     end
      else
     begin
      top2:=top2+1;
      mas2[top2]:=cur;
      top1:=top1-1;
     end;
   end;
   for i:=top2 downto 1 do
    if i=1 then
     writeln(mas2[i])
      else
     write(mas2[i],' ');
   readln
end.