#include <bits/stdc++.h>
using namespace std;
struct rec {
  int x, y, c;
} a[105];
bool cmp(rec B, rec C) {
  if (B.y != C.y) return B.y < C.y;
  return B.x < C.x;
}
int n, ret[105];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &a[i].x, &a[i].y);
    a[i].c = i;
  }
  sort(a, a + n, cmp);
  int low = a[n - 1].y, pos = n - 1;
  priority_queue<pair<int, int> > q;
  while ((pos >= 0) || (!q.empty())) {
    while (pos >= 0 && a[pos].y >= low) {
      q.push(make_pair(a[pos].x, a[pos].c));
      pos--;
    }
    if (q.empty())
      low = a[pos].y;
    else {
      pair<int, int> pp = q.top();
      q.pop();
      ret[pp.second] = low;
      low--;
    }
  }
  for (int i = 0; i < n; i++) printf("%d ", ret[i]);
  printf("\n");
}
