#include <bits/stdc++.h>
using namespace std;
char solution[10000000];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int n;
  cin >> n;
  vector<pair<int, int> > intervals;
  vector<string> strings;
  strings.reserve(n);
  intervals.reserve(1000000);
  for (int i = 0; i < n; i++) {
    string st;
    cin >> st;
    strings.push_back(st);
    int positions;
    cin >> positions;
    for (int j = 0; j < positions; j++) {
      int p;
      cin >> p;
      intervals.push_back(make_pair(p, i));
    }
  }
  for (int i = 0; i < 10000000; i++) {
    solution[i] = 'a';
  }
  solution[10000000 - 1] = '\0';
  int lastWriten = 0;
  sort(intervals.begin(), intervals.end());
  for (int i = 0; i < intervals.size(); i++) {
    for (int j = max(lastWriten + 1, intervals[i].first);
         j < intervals[i].first + strings[intervals[i].second].size(); j++) {
      solution[j] = strings[intervals[i].second][j - intervals[i].first];
      lastWriten = j;
    }
  }
  solution[lastWriten + 1] = '\0';
  cout << &solution[1] << endl;
  return 0;
}
