#include <bits/stdc++.h>
using namespace std;
int n, cnt, pos, sz, mx, last, start;
char s[2000005], ans[2000005];
int main() {
  scanf("%d", &n);
  memset(ans, '\000', sizeof(ans));
  for (register int i = 1; i <= n; i++) {
    scanf("%s", s);
    scanf("%d", &cnt);
    sz = strlen(s);
    for (register int j = 1; j <= cnt; j++) {
      scanf("%d", &pos);
      if (j == 1) {
        start = 0;
      } else {
        start = last + sz - pos;
        if (start < 0) {
          start = 0;
        }
      }
      for (register int k = start; k < sz; k++) {
        ans[k + pos] = s[k];
      }
      last = pos;
      mx = max(mx, pos + sz - 1);
    }
  }
  while (ans[mx] == '\000') {
    mx--;
  }
  for (register int i = 1; i <= mx; i++) {
    if (ans[i] == '\000') {
      ans[i] = 'a';
    }
    printf("%c", ans[i]);
  }
  printf("\n");
  return 0;
}
