#include <bits/stdc++.h>
using namespace std;
const int Maxn = 105;
int n, ans[Maxn];
bool vis[10000005];
struct node {
  int l, r, id;
} a[Maxn];
bool cmp(node x, node y) {
  if (x.r == y.r)
    return x.l < y.l;
  else
    return x.r < y.r;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i].l >> a[i].r, a[i].id = i;
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
    int j = a[i].l;
    while (vis[j] && j <= a[i].r) ++j;
    vis[j] = true;
    ans[a[i].id] = j;
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
