#include <bits/stdc++.h>
using namespace std;
string a[1000006];
char c[1000006];
long len[2000006], r[2000006];
int main() {
  long n;
  cin >> n;
  char xxx[10];
  gets(xxx);
  long k, x, l = 0;
  memset(r, 0, sizeof(r));
  len[0] = 0;
  for (long i = 1; i <= n; ++i) {
    scanf("%s", c);
    a[i] = c;
    len[i] = a[i].length();
    scanf("%ld", &k);
    for (long j = 0; j < k; j++) {
      scanf("%ld", &x);
      --x;
      if (r[x]) {
        if (len[r[x]] < len[i]) r[x] = i;
      } else
        r[x] = i;
      l = max(l, len[r[x]] + x);
    }
    gets(xxx);
  }
  for (long i = 0, j = 0; i < l; ++i) {
    if (j < i) j = i;
    if (j < i + len[r[i]])
      j = i + len[r[i]];
    else
      r[i] = 0;
  }
  for (long i = 0, j = 0; i < l; ++i) {
    if (r[i]) j = i;
    if (i >= j + len[r[j]]) {
      printf("a");
      continue;
    }
    if (r[j] == 0) {
      printf("a");
      continue;
    }
    printf("%c", a[r[j]][i - j]);
  }
  cout << endl;
  return 0;
}
