#include <bits/stdc++.h>
int n, f[3000007], k, mx = 0;
char s[3000007], s1[3000007];
int gf(int x) {
  while (x != f[x]) x = f[x] = x[f][f];
  return x;
}
int main() {
  for (int i = 1; i <= 3000000; ++i) f[i] = i;
  for (scanf("%d", &n); n; --n) {
    scanf("%s%d", s1, &k);
    int len = strlen(s1);
    for (int x; k; --k) {
      scanf("%d", &x);
      for (int i = gf(x); i < x + len; i = f[i] = gf(i + 1)) {
        s[i] = s1[i - x];
        if (i > mx) mx = i;
      }
    }
  }
  for (int i = 1; i <= mx; ++i) putchar(s[i] ? s[i] : 'a');
  puts("");
  return 0;
}
