#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5, maxl = 2e6 + 5;
int n, lens, lent, k;
int nxt[maxl], tnxt[maxl];
char s[maxl], t[maxl];
int getint() {
  char ch;
  int res = 0, p;
  while (!isdigit(ch = getchar()) && (ch ^ '-'))
    ;
  p = ch == '-' ? ch = getchar(), -1 : 1;
  while (isdigit(ch)) res = (res << 3) + (res << 1) + (ch ^ 48), ch = getchar();
  return res * p;
}
void cov(int x) {
  lens = max(lens, x + lent - 1);
  for (int i = x; i <= x + lent - 1; i = nxt[i]) tnxt[i] = nxt[i];
  for (int i = x; i <= x + lent - 1; i = tnxt[i]) {
    s[i] = t[i - x + 1];
    nxt[i] = x + lent;
  }
}
int main() {
  n = getint();
  for (int i = 1; i <= 2e6; ++i) nxt[i] = i + 1;
  for (int i = 1; i <= n; ++i) {
    scanf("%s", t + 1);
    lent = strlen(t + 1);
    k = getint();
    for (int j = 1; j <= k; ++j) {
      int x;
      x = getint();
      cov(x);
    }
  }
  for (int i = 1; i <= lens; ++i) putchar(s[i] ? s[i] : 'a');
  return 0;
}
