#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int MAXN = 300005, MAXM = 2000005;
struct list {
  int l, lt[MAXN], nt[MAXN], x[MAXN], y[MAXN];
  void clear() {
    l = 0;
    memset(lt, 0, sizeof(lt));
  }
  void addedge(int a, int b) {
    l++;
    nt[l] = lt[a];
    lt[a] = l;
    x[l] = b;
  }
} E;
char s[MAXM], t[MAXM];
int n, m, M, a[MAXM], b[MAXM], l[MAXM];
int main() {
  n = read();
  M = m = 0;
  l[0] = 0;
  memset(a, 0, sizeof(a));
  for (int i = (1); i <= (n); ++i) {
    b[i] = m;
    for (char ch = getchar(); ch >= 'a' && ch <= 'z'; ch = getchar())
      t[++m] = ch;
    l[i] = m - b[i];
    b[i]++;
    int x = read();
    for (int j = (1); j <= (x); ++j) {
      int y = read();
      M = max(M, y + l[i] - 1);
      if (l[a[y]] < l[i]) a[y] = i;
    }
  }
  n = m = 0;
  t[0] = 'a';
  b[0] = 0;
  for (int i = (1); i <= (M); ++i) {
    if (m <= l[a[i]]) {
      m = l[a[i]];
      n = b[a[i]];
    }
    s[i] = t[n];
    m--;
    n++;
  }
  s[M + 1] = 0;
  printf("%s\n", s + 1);
  return 0;
}
