#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<string> tab(N);
  vector<pair<int, int> > event;
  for (int i = 0; i < N; i++) {
    cin >> tab[i];
    int nb;
    cin >> nb;
    for (int j = 0; j < nb; j++) {
      int x;
      cin >> x;
      event.push_back(pair<int, int>(x - 1, i));
    }
  }
  sort(event.begin(), event.end());
  int encours, ending = -1, j = 0;
  for (int i = 0; i < ending || j < (int)event.size(); i++) {
    while (j < (int)event.size() && event[j].first <= i) {
      if (event[j].first + (int)tab[event[j].second].size() > ending) {
        ending = event[j].first + tab[event[j].second].size();
        encours = event[j].second;
      }
      j++;
    }
    if (i < ending)
      printf("%c", tab[encours][tab[encours].size() + i - ending]);
    else
      printf("a");
  }
  printf("\n");
}
