#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<int, vector<pair<int, int> > > mp;
  int res[200], mini = INT_MAX;
  for (int i = 0; i < n; i++) {
    pair<int, int> p;
    scanf("%d%d", &p.first, &p.second);
    mp[p.first].push_back({p.second, i});
  }
  int cur = 0;
  priority_queue<pair<int, int>, vector<pair<int, int> >,
                 greater<pair<int, int> > >
      pq;
  for (auto m : mp) {
    while (!pq.empty() && cur < m.first) {
      auto j = pq.top();
      pq.pop();
      res[j.second] = cur++;
    }
    if (pq.empty()) {
      cur = m.first;
    }
    for (auto i : m.second) {
      pq.push(i);
    }
  }
  while (!pq.empty()) {
    auto j = pq.top();
    pq.pop();
    res[j.second] = cur++;
  }
  for (int i = 0; i < n; i++) {
    cout << res[i] << " ";
  }
}
