#include <bits/stdc++.h>
using namespace std;
const int maxn = 3000000 + 5;
int f[maxn], nextt[maxn];
char ch[maxn];
int len;
char ans[maxn];
int main() {
  int n, i, t, j, k;
  for (i = 0; i < 3000000; i++) nextt[i] = i + 1;
  int now = 0, maxx = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    getchar();
    scanf("%s", ch);
    scanf("%d", &len);
    int lenn = strlen(ch);
    for (j = 0; j < len; j++) {
      scanf("%d", &k);
      for (int index = k; index < k + lenn;) {
        ans[index] = ch[index - k];
        int tt = nextt[index];
        if (tt < k + lenn) nextt[index] = nextt[tt];
        index = tt;
      }
      maxx = max(maxx, lenn + k - 1);
    }
  }
  for (i = 1; i <= maxx; i++) {
    if (ans[i] == 0) ans[i] = 'a';
  }
  ans[maxx + 1] = 0;
  printf("%s\n", ans + 1);
  return 0;
}
