#include <bits/stdc++.h>
using namespace std;
int N, Ans[111];
pair<pair<int, int>, int> P[111];
set<int> mySet;
int main(int argc, char *argv[]) {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d%d", &P[i].first.first, &P[i].first.second);
    P[i].second = i;
  }
  sort(P, P + N);
  for (int i = N - 1; i >= 0; i--) {
    int l = P[i].first.first;
    int r = P[i].first.second;
    for (int j = r; j >= l; j--)
      if (mySet.find(j) == mySet.end()) {
        mySet.insert(j);
        Ans[P[i].second] = j;
        break;
      }
  }
  printf("%d", Ans[0]);
  for (int i = 1; i < N; i++) {
    printf(" %d", Ans[i]);
  }
  printf("\n");
  return 0;
}
