#include <bits/stdc++.h>
using namespace std;
char s[2000005];
char s1[2000005];
int main() {
  int n;
  int sum;
  int p;
  while (~scanf("%d", &n)) {
    memset(s, 0, sizeof(s));
    int max1 = 0;
    for (int c = 1; c <= n; c++) {
      scanf("%s", s1);
      int l = strlen(s1);
      scanf("%d", &sum);
      int t = -100;
      for (int i = 1; i <= sum; i++) {
        scanf("%d", &p);
        p--;
        for (int j = max(p, t); j < p + l; j++) s[j] = s1[j - p];
        t = p + l;
        max1 = max(max1, p + l - 1);
      }
    }
    for (int i = 0; i <= max1; i++) {
      if (s[i] == 0)
        printf("a");
      else
        printf("%c", s[i]);
    }
    printf("\n");
  }
}
