#include <bits/stdc++.h>
using namespace std;
int f[3000000];
char ans[3000000];
char a[3000000];
int find(int a) {
  int r = a;
  while (f[r] != r) r = f[r];
  int i = a;
  int j;
  while (i != r) {
    j = f[i];
    f[i] = r;
    i = j;
  }
  return r;
}
void merge(int a, int b) {
  int A, B;
  A = find(a);
  B = find(b);
  if (A > B) {
    f[B] = A;
  } else
    f[A] = B;
}
int main() {
  int n;
  while (~scanf("%d", &n)) {
    memset(ans, ' ', sizeof(ans));
    int end = 0;
    for (int i = 1; i <= 3000000 - 80; i++) f[i] = i;
    for (int i = 1; i <= n; i++) {
      scanf("%s", a);
      int lenn = strlen(a);
      int ki;
      scanf("%d", &ki);
      while (ki--) {
        int x;
        scanf("%d", &x);
        int tmpx = x;
        end = max(end, lenn + x - 1);
        while (x <= tmpx + lenn - 1) {
          ans[x] = a[x - tmpx + 1 - 1];
          x = find(x);
          if (x <= tmpx + lenn - 1) merge(x, x + 1);
        }
      }
    }
    for (int i = 1; i <= end; i++) {
      if (ans[i] == ' ') ans[i] = 'a';
      printf("%c", ans[i]);
    }
    printf("\n");
  }
}
