#include <bits/stdc++.h>
using namespace std;
string Answer;
int n;
int Maxt;
string h[131072];
vector<int> add;
vector<int> del;
struct ots {
  int start, final;
  int index;
};
vector<ots> o;
bool cmp(ots first, ots second) {
  if (first.start < second.start) return true;
  if (first.start > second.start) return false;
  if (first.final < second.final) return true;
  if (first.final > second.final) return false;
  if (first.index < second.index) return true;
  if (first.index > second.index) return false;
  return true;
}
int main() {
  cin >> n;
  int i;
  for (i = 0; i < n; i++) {
    cin >> h[i];
    int sz = (h[i].size());
    int count;
    cin >> count;
    int jj;
    for (jj = 0; jj < count; jj++) {
      ots help;
      int start;
      cin >> start;
      start--;
      help.start = start;
      help.final = start + sz;
      Maxt = max(Maxt, help.final);
      help.index = i;
      o.push_back(help);
    }
  }
  sort(o.begin(), o.end(), cmp);
  int Osz = o.size();
  for (i = 0; i < Maxt; i++) Answer += 'a';
  int ToHere = false;
  for (i = 0; i < Osz; i++) {
    int TotalEl = ToHere - o[i].start;
    if (TotalEl < false) TotalEl = false;
    o[i].start = max(o[i].start, ToHere);
    int jj;
    for (jj = o[i].start; jj < o[i].final; jj++, TotalEl++) {
      Answer[jj] = h[o[i].index][TotalEl];
    }
    ToHere = max(ToHere, o[i].final);
  }
  cout << Answer << endl;
  return 0;
}
