#include <bits/stdc++.h>   using namespace std;   char s[2000006];   char t[1000006];   int len[100005], pos[100005];   vector<pair<int, int>> e;   int main() {     int n;     scanf( %d , &n);     int tp = 0;     for (int i = 0; i < n; i++) {       scanf( %s , t + tp);       len[i] = strlen(t + tp);       pos[i] = tp;       tp += len[i];       int ki;       scanf( %d , &ki);       while (ki--) {         int xij;         scanf( %d , &xij);         e.push_back({xij - 1, i});       }     }     int p = 0;     sort(e.begin(), e.end());     int esz = (int)e.size();     tp = -1;     int te = -1, sp = 0;     while (p < esz) {       int f = e[p].first;       while (sp < f) {         if (tp != -1) {           s[sp++] = t[tp++];           if (tp >= te) tp = te = -1;         } else           s[sp++] =  a ;       }       if (tp == -1) {         tp = pos[e[p].second];         te = pos[e[p].second] + len[e[p].second];       } else if (len[e[p].second] > te - tp) {         tp = pos[e[p].second];         te = pos[e[p].second] + len[e[p].second];       }       while (p + 1 < esz && e[p + 1].first == e[p].first) {         p++;         if (len[e[p].second] > te - tp) {           tp = pos[e[p].second];           te = pos[e[p].second] + len[e[p].second];         }       }       p++;     }     while (tp < te) s[sp++] = t[tp++];     s[sp] =   0 ;     printf( %s , s);     return 0;   }   