#include <bits/stdc++.h>
using namespace std;
struct node {
  int value1, value2;
} ddata[200001];
struct ArcNode {
  int adjvex;
  struct ArcNode *next;
};
int n;
bool visit[200001];
struct VNode {
  int data;
  struct ArcNode *firstarc;
} AdjList[200001];
void print() {
  for (int i = 1; i <= n; i++) {
    ArcNode *p = AdjList[i].firstarc;
    while (p) {
      cout << p->adjvex << " ";
      p = p->next;
    }
    cout << endl;
  }
}
int result[200001];
bool dfs(int adjvex, int sum) {
  if (visit[adjvex]) {
    if (sum == n) {
      bool flag = false;
      if ((result[1] == ddata[1].value1 && result[2] == ddata[1].value2) ||
          (result[1] == ddata[1].value2 && result[2] == ddata[1].value1)) {
        for (int i = 0; i < n; i++) {
          if (flag) cout << " ";
          flag = true;
          cout << result[i];
        }
      } else {
        for (int i = n - 1; i >= 0; i--) {
          if (flag) cout << " ";
          flag = true;
          cout << result[i];
        }
      }
      return true;
    }
    return false;
  } else {
    result[sum] = adjvex;
    visit[adjvex] = true;
    ArcNode *p = AdjList[adjvex].firstarc;
    while (p) {
      if (dfs(p->adjvex, sum + 1)) return true;
      p = p->next;
    }
    visit[adjvex] = false;
  }
  return false;
}
int main() {
  scanf("%d", &n);
  memset(visit, false, sizeof(visit));
  for (int i = 1; i <= n; i++) AdjList[i].firstarc = NULL;
  int value1, value2;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &value1, &value2);
    ddata[i].value1 = value1;
    ddata[i].value2 = value2;
    struct ArcNode *pNew;
    pNew = new ArcNode;
    pNew->adjvex = value2;
    pNew->next = AdjList[value1].firstarc;
    AdjList[value1].firstarc = pNew;
    pNew = new ArcNode;
    pNew->adjvex = value1;
    pNew->next = AdjList[value2].firstarc;
    AdjList[value2].firstarc = pNew;
  }
  dfs(1, 0);
  return 0;
}
