#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int n, fa[3000007], k;
char s[3000007], s1[3000007];
int find_fa(int x) { return fa[x] == x ? x : fa[x] = find_fa(fa[x]); }
int main() {
  int maxx = 0;
  for (int i = 0; i <= 3000000; i++) fa[i] = i;
  scanf("%d", &n);
  while (n--) {
    scanf("%s%d", s1, &k);
    int len = strlen(s1);
    int x;
    while (k--) {
      scanf("%d", &x);
      for (int i = find_fa(x); i < x + len; i = fa[i] = find_fa(i + 1)) {
        s[i] = s1[i - x];
        if (i > maxx) maxx = i;
      }
    }
  }
  for (int i = 1; i <= maxx; i++) putchar(s[i] ? s[i] : 'a');
  puts("");
  return 0;
}
