#include <bits/stdc++.h>
using namespace std;
const int Maxn = 105;
int n;
pair<int, int> seq[Maxn];
int ind[Maxn], res[Maxn];
priority_queue<pair<int, int> > Q;
bool Less(const int &a, const int &b) { return seq[a] < seq[b]; }
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &seq[i].first, &seq[i].second);
    ind[i] = i;
  }
  sort(ind, ind + n, Less);
  int i = 0;
  for (int d = 1; d <= 10000000; d++) {
    while (i < n && seq[ind[i]].first == d) {
      Q.push(make_pair(-seq[ind[i]].second, ind[i]));
      i++;
    }
    if (!Q.empty()) {
      res[Q.top().second] = d;
      Q.pop();
    }
  }
  for (int i = 0; i < n; i++) printf("%d%c", res[i], i + 1 < n ? ' ' : '\n');
  return 0;
}
