#include <bits/stdc++.h>
using namespace std;
int l[101], r[101], ans[101], b[101], n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &l[i], &r[i]);
  }
  l[0] = 2147483647;
  r[0] = 2147483647;
  for (int i = 1; i <= n; i++) {
    int k = 0;
    for (int j = 1; j <= n; j++) {
      if (!b[j] && (l[j] < l[k]))
        k = j;
      else if (!b[j] && l[j] == l[k] && r[j] < r[k])
        k = j;
    }
    ans[k] = l[k];
    b[k] = 1;
    for (int j = 1; j <= n; j++) {
      if (l[j] < ans[k] + 1) l[j] = ans[k] + 1;
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
}
