#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
int cn, T, n, m, l[105], r[105], ans[105];
vector<pii> lri[10000005];
priority_queue<pii, vector<pii>, greater<pii>> ri;
int main() {
  cin.tie(NULL);
  scanf("%d", &n);
  for (auto i = 1; i <= n; i += 1)
    scanf("%d%d", &l[i], &r[i]), lri[l[i]].push_back({r[i], i});
  for (auto i = 1; i <= 10000005; i += 1) {
    for (auto &j : lri[i]) ri.push(j);
    if (!ri.empty()) ans[ri.top().second] = i, ri.pop();
  }
  for (auto i = 1; i <= n; i += 1)
    printf("%d", ans[i]), printf("%c", " \n"[i == n]);
  return 0;
}
