//
// Written by Fyodor Menshikov 17.02.2009
// 10:42-11:36
//

import java.io.*;
import java.util.*;

class Scanner {

   StreamTokenizer in;

   Scanner(Reader r) {
      in = new StreamTokenizer(new BufferedReader(r));
   }

   void asserT(boolean e) {
      if (!e) {
         throw new Error();
      }
   }

   int nextInt() {
      try {
         in.nextToken();
         asserT(in.ttype == in.TT_NUMBER);
         int value = (int)in.nval;
         asserT(value == in.nval);
         return value;
      } catch (IOException e) {
         throw new Error(e);
      }
   }
}

class CycleFound extends Exception {}

class Road {

   City city1;
   City city2;
   boolean isRemoved = false;

   Road(City city1, City city2) {
      this.city1 = city1;
      this.city2 = city2;
      city1.addRoad(this);
      city2.addRoad(this);
   }

   void addToTree(City from) {
      if (this.isRemoved) {
         return;
      }
      if (from == city1) {
         if (!city2.isInTree) {
            this.isRemoved = true;
            city2.addToTree();
         }
      } else if (from == city2) {
         if (!city1.isInTree) {
            this.isRemoved = true;
            city1.addToTree();
         }
      } else {
         throw new Error();
      }
   }

   void findCycle(City from, Stack<City> stack) throws CycleFound {
      if (this.isRemoved) {
         return;
      }
      this.isRemoved = true;
      if (from == city1) {
         city2.findCycle(stack);
      } else if (from == city2) {
         city1.findCycle(stack);
      } else {
         throw new Error();
      }
   }
}

class City {

   int id;
   boolean isInTree = false;
   boolean isInCycle = false;
   LinkedList<Road> roads = new LinkedList<Road>();

   City(int id) {
      this.id = id;
   }

   void asserT(boolean e) {
      if (!e) {
         throw new Error();
      }
   }

   void addRoad(Road road) {
      roads.add(road);
   }

   void addToTree() {
      asserT(!isInTree);
      isInTree = true;
      for (Road r : roads) {
         r.addToTree(this);
      }
   }

   void findCycle(Stack<City> stack) throws CycleFound {
      stack.push(this);
      if (isInCycle) {
         throw new CycleFound();
      }
      asserT(!isInCycle);
      isInCycle = true;
      for (Road r : roads) {
         r.findCycle(this, stack);
      }
      asserT(stack.pop() == this);
   }

   public String toString() {
      return "" + id;
   }
}

public class Main extends Thread {

   Scanner in;
   PrintWriter out;

   void asserT(boolean e) {
      if (!e) {
         throw new Error();
      }
   }

   void solve() {
      int nCities = in.nextInt();
      asserT(1 <= nCities && nCities <= 100000);
      int nRoads = in.nextInt();
      asserT(nCities * 2 <= nRoads && nRoads <= nCities * 3);
      City cities[] = new City[1 + nCities];
      for (int i = 1; i <= nCities; i++) {
         cities[i] = new City(i);
      }
      for (int i = 0; i < nRoads; i++) {
         new Road(cities[in.nextInt()], cities[in.nextInt()]);
      }
      cities[1].addToTree();
      for (City c : cities) {
         asserT(c == null || c.isInTree);
      }
      Stack<City> stack = new Stack<City>();
      for (City c : cities) {
         if (c == null) {
            continue;
         }
         if (c.isInCycle) {
            continue;
         }
         try {
            asserT(stack.isEmpty());
            c.findCycle(stack);
         } catch (CycleFound cf) {
            City first = stack.pop();
            out.print(first);
            out.print(" ");
            while (true) {
               City city = stack.pop();
               if (city == first) {
                  break;
               }
               out.print(city);
               out.print(" ");
            }
            out.println(first);
            return;
         }
      }
      throw new Error();
   }

   public void run() {
      try {
         in = new Scanner(new InputStreamReader(System.in));
         out = new PrintWriter(System.out);
      } catch (Exception e) {
         throw new Error(e);
      }
      try {
         solve();
      } finally {
         out.close();
      }
   }

   public static void main(String args[]) {
      new Thread(null, new Main(), "Main", 64000000).start();
   }
}