#include <bits/stdc++.h>   const int MAXINT = 2147483640;   const long long MAXLL = 9223372036854775800LL;   const long long MAXN = 1000000;   using namespace std;   int l[MAXN], r[MAXN];   int n;   int ans[MAXN];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int T;     cin >> T;     while (T--) {       cin >> n;       for (int i = 1; i <= n; ++i) ans[i] = 0;       for (int i = 1; i <= n; ++i) cin >> l[i] >> r[i];       int t = l[1];       ans[1] = t;       for (int i = 2; i <= n; ++i) {         if (r[i] <= t)           ans[i] = 0;         else {           ans[i] = max(l[i], t + 1);           t = ans[i];         }       }       for (int i = 1; i <= n; ++i) cout << ans[i] <<    ;       cout <<   n ;     }     return 0;   }   