#include <bits/stdc++.h>
using namespace std;
int n, result[100], start, finish;
pair<pair<int, int>, int> per[101];
bool check[10000001];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> per[i].first.second >> per[i].first.first;
    per[i].second = i;
  }
  sort(per, per + n);
  for (int i = 0; i < n; i++) {
    start = per[i].first.second;
    finish = per[i].first.first;
    for (start; start <= finish; start++) {
      if (check[start] == false) {
        result[per[i].second] = start;
        check[start] = true;
        break;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << result[i];
    if (i != n - 1) {
      cout << " ";
    }
  }
  return 0;
}
