#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
pair<int, int> a[111];
int ind[111], ans[111];
int mark[10000010];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = (0); i < (n); ++i) scanf("%d %d", &a[i].first, &a[i].second);
  for (int i = (0); i < (n); ++i) ind[i] = i;
  sort(ind, ind + n, [&](int aa, int bb) {
    pair<int, int> x = a[aa], y = a[bb];
    if (x.second != y.second) return x.second < y.second;
    return x.first < y.first;
  });
  for (int i = (0); i < (n); ++i) {
    int l = a[ind[i]].first;
    while (mark[l]) l++;
    mark[l] = 1;
    ans[ind[i]] = l;
  }
  for (int i = (0); i < (n); ++i) {
    printf("%d ", ans[i]);
  }
  printf("\n");
  return 0;
}
