#include <bits/stdc++.h>
using namespace std;
int pre[2000006];
int find(int x) { return pre[x] == x ? x : pre[x] = find(pre[x]); }
void join(int x, int y) {
  int rx = find(x);
  int ry = find(y);
  if (rx != ry) pre[rx] = ry;
  return;
}
int main() {
  char a[1000006], c[2000006];
  for (int i = 1; i <= 2e6; i++) {
    pre[i] = i;
  }
  int n, t, l, x, mx = 0;
  scanf("%d", &n);
  getchar();
  memset(c, 0, sizeof(c));
  for (int i = 1; i <= n; i++) {
    scanf("%s%d", a, &t);
    l = strlen(a);
    for (int j = 1; j <= t; j++) {
      scanf("%d", &x);
      if (find(x) <= x + l - 1) {
        for (int k = pre[x]; k <= x + l - 1; k++) {
          c[k] = a[k - x];
          join(k, x + l);
        }
        mx = max(mx, x + l);
      }
    }
    getchar();
  }
  for (int i = 1; i <= mx - 1; i++) {
    if (c[i] != 0)
      printf("%c", c[i]);
    else
      printf("a");
  }
  printf("\n");
  return 0;
}
