#include <bits/stdc++.h>
using namespace std;
int n, i, x[110];
bool viz[10000010];
pair<pair<int, int>, int> v[110];
int main() {
  cin >> n;
  for (i = 1; i <= n; ++i) {
    cin >> v[i].first.second >> v[i].first.first;
    v[i].second = i;
  }
  sort(v + 1, v + n + 1);
  for (i = 1; i <= n; ++i) {
    while (viz[v[i].first.second]) {
      ++v[i].first.second;
    }
    x[v[i].second] = v[i].first.second;
    viz[v[i].first.second] = 1;
  }
  for (i = 1; i <= n; ++i) {
    cout << x[i] << ' ';
  }
  cout << "\n";
  return 0;
}
