[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
declare an integer n
declare a string t
declare an integer k
declare an integer ans_len
declare a character array str of size 20 * 100010
declare an integer array chars of size 80 * 100010
in function push_up with parameter integer rt
    set chars[rt] to chars[rt shift bits left 1] + chars[r1 shift bits left 1 bitwise or 1]
end of the block
in function update with parameters integers L, R, left, right, rt
    if chars[rt] is at least right - left + 1
    if left equals right
        assign 1 to chars[rt]
        assign t[left - L] to str[left]
        return
    end of the block
    if L is greater than right or R is less than left, return
    mid = integer = (left + right) shift bits left 1
    if mid is at least R
        call update with arguments L, R, left, mid, rt shift bits left 1
    else if mid is less than L
        call update with arguments L, R, mid + 1, right, rt shift bits left 1 bitwise or 1
    else
        call update with arguments L, R, left, mid, rt shift bits left 1
        call update with arguments L, R, mid + 1, right, rt shift bits left 1 bitwise or 1
    end of the block
    call push_up with argument rt
end of the block
define the main function
    declare an integer pos
    declare an integer endpos
    input n
    assign 0 to ans_len
    for i = 1 to 2000010 exclusive, assign the character a to str[i]
    call memset with arguments chars, 0, call sizeof with argument chars
    for i = 1 to n inclusive
        input t and k
        for j = 1 to k inclusive
            input pos
            set endpos to pos + (the length of t) - 1
            call update with arguments pos, endpos, 1, 2000010, 1
            if j is equal to k
                if endpos is greater than ans_len, assign endpos to ans_len
            end of the block
        end of the block
    end of the block
    for i = 1 to ans_len inclusive, display str[i]
    print newline
end of the block

[CODE]:

int n;
string t;
int k;
int ans_len;
char str[20 * 100010];
int chars[80 * 100010];
void push_up(int rt) {
    chars[rt] = chars[rt << 1] + chars[rt << 1 | 1];
}
void update(int L, int R, int left, int right, int rt) {
    if (chars[rt] >= right - left + 1) return;
    if (left == right) {
        chars[rt] = 1;
        str[left] = t[left - L];
        return;
    }
    if (L > right || R < left) return;
    int mid = (left + right) >> 1;
    if (mid >= R)
        update(L, R, left, mid, rt << 1);
    else if (mid < L)
        update(L, R, mid + 1, right, rt << 1 | 1);
    else {
        update(L, R, left, mid, rt << 1);
        update(L, R, mid + 1, right, rt << 1 | 1);
    }
    push_up(rt);
}
int main() {
    int pos;
    int endpos;
    cin >> n;
    ans_len = 0;
    for (int i = 1; i < 2000010; i++) str[i] = 'a';
    memset(chars, 0, sizeof(chars));
    for (int i = 1; i <= n; i++) {
        cin >> t >> k;
        for (int j = 1; j <= k; j++) {
            cin >> pos;
            endpos = pos + t.length() - 1;
            update(pos, endpos, 1, 2000010, 1);
            if (j == k) {
                if (endpos > ans_len) ans_len = endpos;
            }
        }
    }
    for (int i = 1; i <= ans_len; i++) cout << str[i];
    cout << endl;
}