#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e7 + 5;
char str[maxn], ans[maxn];
int nex[maxn], n, k;
int main(void) {
  while (cin >> n) {
    memset(ans, 0, sizeof(ans));
    int e = 0;
    for (int i = 1; i < maxn; i++) nex[i] = i + 1;
    while (n--) {
      scanf(" %s %d", str, &k);
      int len = strlen(str);
      while (k--) {
        int st;
        scanf("%d", &st);
        e = max(e, st + len - 1);
        int p = st;
        while (p < st + len) {
          ans[p] = str[p - st];
          int t = p;
          p = nex[p];
          nex[t] = st + len;
        }
      }
    }
    for (int i = 1; i <= e; i++) {
      if (!ans[i])
        printf("a");
      else
        printf("%c", ans[i]);
    }
    puts("");
  }
  return 0;
}
