#include <bits/stdc++.h>
using namespace std;
char ans[3000005];
int needed[3000005];
int find_next(int x) {
  if (needed[x] == x) return x;
  return needed[x] = find_next(needed[x]);
}
int main() {
  int n, f, pos, N = 0;
  scanf("%d", &n);
  for (int i = 0; i < 3000005; ++i) needed[i] = i;
  while (n--) {
    string s;
    cin >> s;
    scanf("%d", &f);
    while (f--) {
      scanf("%d", &pos);
      N = max(pos + (int)(s.size()) - 1, N);
      if ((int)(s.size()) == 1) {
        ans[pos] = s[0];
        needed[pos] = find_next(pos + 1);
      } else {
        int idx = find_next(pos);
        while (idx - pos < (int)(s.size())) {
          ans[idx] = s[idx - pos];
          idx = needed[idx] = find_next(idx + 1);
        }
      }
    }
  }
  for (int i = 1; i <= N; ++i) {
    if (!ans[i])
      printf("a");
    else
      printf("%c", ans[i]);
  }
  return 0;
}
