#include <bits/stdc++.h>
using namespace std;
const int MAX = 109, M = 1e7 + 9;
pair<pair<int, int>, int> a[MAX];
bool mark[M];
int ans[MAX];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> a[i].first.second >> a[i].first.first, a[i].second = i;
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    while (mark[a[i].first.second]) a[i].first.second++;
    ans[a[i].second] = a[i].first.second;
    mark[a[i].first.second] = 1;
  }
  for (int i = 0; i < n; i++) cout << ans[i] << ' ';
}
