#include <bits/stdc++.h>
using namespace std;
const int N = 107;
int n;
pair<pair<int, int>, int> p[N];
unordered_map<int, bool> used;
int ans[N];
bool cmp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  return a.first.second < b.first.second;
}
int main() {
  cin >> 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, cmp);
  for (int i = 0; i < n; i++) {
    for (int j = p[i].first.first; j <= p[i].first.second; j++) {
      if (!used[j]) {
        used[j] = 1;
        ans[p[i].second] = j;
        break;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%d ", ans[i]);
  }
  return 0;
}
