#include <bits/stdc++.h>

using namespace std;
using ll = long long;

// generated at caterpillow.github.io/byot

namespace Treap {

    mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
    using ptr = struct Node*;
    
    struct Node {
    
        int key;
        int sz;
        int pri;
        ptr l, r;
    
        Node() {
            pri = mt();
            sz = 1;
            l = r = nullptr;
        }
    
        Node(int key) : key(key) {
            pri = mt();
            sz = 1;
            l = r = nullptr;
        }
    };
    
    int sz(ptr n) { return n ? n->sz : 0; };
    
    ptr pull(ptr n) {
        if (!n) return nullptr;
        n->sz = sz(n->l) + 1 + sz(n->r);
        return n;
    }
    
    ptr merge(ptr l, ptr r) {
        if (!l || !r) return l ? l : r;
        if (l->pri > r->pri) return l->r = merge(l->r, r), pull(l);
        else return r->l = merge(l, r->l), pull(r);
    }
    
    template<typename... Args>
    ptr merge(ptr l, Args... args) {
        return merge(l, merge(args...));
    }
    
    // [-inf, i) and [i, inf]
    pair<ptr, ptr> spliti(ptr n, int i) {
        if (!n) return {nullptr, nullptr};
        if (i <= sz(n->l)) {
            auto [l, r] = spliti(n->l, i);
            n->l = r;
            return {l, pull(n)};
        } else {
            auto [l, r] = spliti(n->r, i - 1 - sz(n->l));
            n->r = l;
            return {pull(n), r};
        }
    }
    
    void heapify(ptr n) {
        if (!n) return;
        ptr mx = n;
        if (n->l && n->l->pri > mx->pri) mx = n->l;
        if (n->r && n->r->pri > mx->pri) mx = n->r;
        if (mx != n) swap(n->pri, mx->pri), heapify(mx);
    }
    
    ptr build(vector<ptr>& ns, int l = 0, int r = -69) {
        if (r == -69) r = (int) ns.size() - 1;
        if (l > r) return nullptr;
        if (l == r) return ns[l];
        int m = (l + r) / 2;
        ns[m]->l = build(ns, l, m - 1);
        ns[m]->r = build(ns, m + 1, r);
        heapify(ns[m]);
        return pull(ns[m]);
    }
    
    template <typename Op>
    void tour(ptr n, Op op) {
        stack<ptr> stk;
        while (n || !stk.empty()) {
            for (; n; n = n->l) stk.push(n);
            n = stk.top(); stk.pop();
            op(n);
            n = n->r;
        }
    }

}

using namespace Treap;

/*

- wrap in namespace
- include n-way merge (and merge)
- include split at index (and size)
- include heapify + build
- include tour

*/

int n;
ptr treap;

void random_shuffle(int a, int b) {
    if (b < a) return;
    int len = min(b - a, n - b);
    int l0 = a;
    int r0 = a + len;
    int l1 = b;
    int r1 = b + len;
    auto [lxmy, r] = spliti(treap, r1);
    auto [lxm, y] = spliti(lxmy, l1);
    auto [lx, m] = spliti(lxm, r0);
    auto [l, x] = spliti(lx, l0);
    treap = Treap::merge(l, y, m, x, r); // merge with 5+ arguments requires namespace, since it conflicts with std::merge
}

main() {
    cin.tie(0)->sync_with_stdio(0);
    
    cin >> n;

    // O(n) build
    vector<ptr> ns(n);
    for (int i = 0; i < n; i++) ns[i] = new Node(i + 1);
    treap = build(ns);

    for (int i = 0; i < n; i++) {
        int a, b; cin >> a >> b;
        random_shuffle(a - 1, b - 1);
    }

    tour(treap, [&] (ptr n) { cout << n->key << ' '; });
}