#include <bits/stdc++.h>
int main() {
  int n, i, j, k, x, y, z, l, ll, minx = 2000000, maxx = -1;
  char s[2000000] = {0}, t[2000000], c;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    l = 0;
    scanf("%c", &c);
    scanf("%s", t);
    l = strlen(t);
    y = -1;
    scanf("%d", &k);
    for (j = 0; j < k; j++) {
      scanf("%d", &x);
      x--;
      if (x <= y) {
        z = y + 1 - x;
        ll = l - z;
        x = y + 1;
      } else {
        z = 0;
        ll = l;
      }
      y = x + ll - 1;
      if (minx > x) minx = x;
      if (maxx < x + ll) maxx = x + ll;
      strncpy(s + x, t + z, ll);
    }
  }
  for (i = 0; i < minx; i++) s[i] = 'a';
  for (i = minx; i < maxx; i++)
    if (s[i] == 0) s[i] = 'a';
  printf("%s\n", s);
  return 0;
}
