#include <bits/stdc++.h>
using namespace std;
vector<string> substrings;
bool cmp(pair<int, int> &a, pair<int, int> &b) {
  if (a.first < b.first) return true;
  if (a.first > b.first) return false;
  if (substrings[a.second].length() > substrings[b.second].length())
    return true;
  return false;
}
int main() {
  int n, m, pos, dlen, maxlen = 1;
  cin >> n;
  string dummy;
  vector<pair<int, int> > v;
  for (int i = 0; i < n; i++) {
    cin >> dummy >> m;
    substrings.push_back(dummy);
    dlen = dummy.length();
    for (int j = 0; j < m; j++) {
      cin >> pos;
      if (dlen + pos - 1 > maxlen) maxlen = dlen + pos - 1;
      v.push_back({pos - 1, i});
    }
  }
  sort(v.begin(), v.end(), cmp);
  string s(maxlen, 'a');
  int curr_pos = v[0].first, offset, copy_size;
  s.replace(curr_pos, substrings[v[0].second].length(),
            substrings[v[0].second]);
  curr_pos += substrings[v[0].second].length();
  for (int i = 1; i < v.size(); i++) {
    if (v[i].first + substrings[v[i].second].length() <= curr_pos) continue;
    offset = curr_pos - v[i].first;
    if (offset < 0) {
      offset = 0;
      curr_pos = v[i].first;
    }
    copy_size = substrings[v[i].second].length() - offset;
    s.replace(curr_pos, copy_size, substrings[v[i].second], offset, copy_size);
    curr_pos += copy_size;
  }
  cout << s << '\n';
  return 0;
}
