#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y, st, ed, len;
} a[1000010];
char str[2000010], ans[2000010];
int n, cnt;
bool cmp(node a, node b) {
  if (a.x < b.x)
    return true;
  else if (a.x == b.x && a.len > b.len)
    return true;
  else
    return false;
}
int main() {
  scanf("%d", &n);
  int pos = 1;
  for (int i = 1; i <= n; i++) {
    scanf("%s", str + pos);
    int len = strlen(str + pos), x;
    scanf("%d", &x);
    for (int j = 1; j <= x; j++) {
      int y;
      scanf("%d", &y);
      a[++cnt] = (node){y, y + len - 1, pos, pos + len - 1, len};
    }
    pos += len;
  }
  a[cnt + 1].x = 1e9;
  sort(a + 1, a + cnt + 1, cmp);
  int last = 0;
  for (int i = 1; i <= cnt; i++) {
    if (a[i].y <= last) continue;
    int st = max(last + 1, a[i].x);
    for (int j = st, k = (st - a[i].x + 1); k <= a[i].len; j++, k++) {
      last = j;
      ans[j] = str[a[i].st + k - 1];
    }
  }
  for (int i = 1; i <= last; i++)
    if (ans[i] < 'a' || ans[i] > 'z')
      printf("a");
    else
      printf("%c", ans[i]);
  printf("\n");
  return 0;
}
