#include <bits/stdc++.h>   using namespace std;   const int maxn = 100 + 2, maxm = 1e7 + 5;   struct node {     int bg, ed, id;   } a[maxn];   int n, ans[maxn];   bool vis[maxm];   bool cmp(node a, node b) { return a.ed < b.ed; }   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d %d , &a[i].bg, &a[i].ed);       a[i].id = i;     }     sort(a, a + n, cmp);     for (int i = 0; i < n; i++) {       int y = a[i].bg;       while (vis[y]) y++;       vis[y] = true;       ans[a[i].id] = y;     }     for (int i = 0; i < n; i++) printf( %d  , ans[i]);     return 0;   }   