#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<string> info(n);
  map<int, vector<int> > start;
  int pos_max = -1;
  for (int i = 0; i < n; ++i) {
    cin >> info[i];
    int starts;
    cin >> starts;
    int index;
    for (int j = 0; j < starts; ++j) {
      cin >> index;
      start[index - 1].push_back(i);
    }
    pos_max = max(index - 1 + (int)info[i].size() - 1, pos_max);
  }
  int front = 0;
  string answer;
  answer.resize(pos_max + 1);
  answer.assign(pos_max + 1, 'a');
  for (auto& pos : start) {
    for (auto id : pos.second) {
      int stretch = info[id].size() + pos.first;
      if (stretch > front) {
        front = max(front, pos.first);
        for (front; front < stretch; ++front) {
          answer[front] = info[id][front - pos.first];
        }
      }
    }
  }
  cout << answer;
}
