#include <bits/stdc++.h>
using namespace std;
char ans[2 * 1000000 + 10], s[1000000 + 10];
int fa[2 * 1000000 + 1];
int ance(int x) { return fa[x] == x ? x : fa[x] = ance(fa[x]); }
int main() {
  int n = 0, m, i;
  scanf("%d", &m);
  for (i = 1; i <= 2 * 1000000; i++) fa[i] = i, ans[i] = 'a';
  while (m--) {
    int x, len;
    scanf("%s%d", s + 1, &x);
    len = strlen(s + 1);
    while (x--) {
      int y;
      scanf("%d", &y);
      n = max(n, y + len - 1);
      for (i = ance(y); i <= y + len - 1; i = fa[i] = ance(fa[i + 1]))
        ans[i] = s[i - y + 1];
    }
  }
  ans[n + 1] = 0;
  printf(ans + 1);
  return 0;
}
