#include <bits/stdc++.h>
using namespace std;
pair<pair<int, int>, int> p[130];
int n, i, j, a[130];
bool us[10000009];
struct cmp {
  bool operator()(const pair<pair<int, int>, int> a,
                  const pair<pair<int, int>, int> b) {
    return a.first.second < b.first.second ||
           (a.first.second == b.first.second && a.first.first < b.first.first);
  }
};
int main() {
  memset(us, false, sizeof us);
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d %d", &p[i].first.first, &p[i].first.second);
    p[i].second = i;
  }
  sort(p + 1, p + n + 1, cmp());
  for (i = 1; i <= n; i++) {
    j = p[i].first.first;
    while (us[j]) j++;
    us[j] = true;
    a[p[i].second] = j;
  }
  for (i = 1; i <= n; i++) {
    printf("%d ", a[i]);
  }
  printf("\n");
}
