#include <bits/stdc++.h>
using namespace std;
int n, l[101], r[101];
int ans[101];
bool vis[101];
inline bool check(const int &now, const int &cmp) {
  if (l[cmp] > l[now])
    return 1;
  else
    return (l[cmp] == l[now] && r[cmp] > r[now]);
}
int main() {
  scanf("%d", &n);
  for (register int i = 1; i <= n; i++) scanf("%d%d", &l[i], &r[i]);
  l[0] = r[0] = 0x3f3f3f3f;
  for (register int i = 1; i <= n; i++) {
    register int k = 0;
    for (register int j = 1; j <= n; j++)
      if (!vis[j] && check(j, k)) k = j;
    ans[k] = l[k];
    vis[k] = 1;
    register int p = ans[k] + 1;
    for (register int j = 1; j <= n; j++)
      if (l[j] < p) l[j] = p;
  }
  for (register int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
