#include <bits/stdc++.h>
using namespace std;
int n;
char str[3 * 1000005], s[1000005];
int Gp[3 * 1000005];
int fa[3 * 1000005];
int findfa(int x) {
  if (x == fa[x]) return x;
  return fa[x] = findfa(fa[x]);
}
void solve() {
  int maxx = -1;
  for (int i = 1; i <= n; i++) {
    int k;
    scanf("%s %d", s + 1, &k);
    int len = strlen(s + 1);
    for (int j = 0; j < k; j++) {
      int m;
      scanf("%d", &m);
      if (m + len - 1 > maxx) maxx = m + len - 1;
      int ends = m + len - 1;
      int x = m;
      x = findfa(x);
      while ((x = findfa(x)) <= ends) {
        str[x] = s[x - m + 1];
        fa[x] = x + 1;
      }
    }
  }
  for (int i = 1; i <= maxx; i++) {
    if (fa[i] == i) {
      str[i] = 'a';
    }
  }
  str[maxx + 1] = '\0';
  printf("%s\n", str + 1);
}
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 1; i < 3 * 1000005; i++) {
      fa[i] = i;
    }
    memset(Gp, 0, sizeof(Gp));
    solve();
  }
  return 0;
}
