#include <bits/stdc++.h>
using namespace std;
pair<pair<int, int>, int> p[101];
bool arr[99999999];
int ans[101];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p[i].first.second >> p[i].first.first;
    p[i].second = i;
  }
  sort(p, p + n);
  for (int i = 0; i < n; i++) {
    while (arr[p[i].first.second]) {
      p[i].first.second++;
    }
    ans[p[i].second] = p[i].first.second;
    arr[p[i].first.second] = 1;
  }
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
  return 0;
}
