#include <bits/stdc++.h>
using namespace std;
clock_t startTime;
int main() {
  srand(time(NULL));
  startTime = clock();
  ios_base::sync_with_stdio(false), cin.tie(0);
  int n;
  cin >> n;
  vector<string> t(n);
  vector<int> k(n);
  vector<vector<int> > x(n);
  int length = 0;
  for (long long i = (0); i < (n); ++i) {
    cin >> t[i];
    cin >> k[i];
    x[i].assign(k[i], 0);
    for (long long j = (0); j < (k[i]); ++j) cin >> x[i][j], x[i][j]--;
    length = max(length, (int)(t[i].size() + x[i][k[i] - 1] - 1));
  }
  vector<pair<int, int> > all_x;
  for (long long i = (0); i < (n); ++i)
    for (auto xx : x[i]) all_x.push_back(make_pair(xx, i));
  sort(all_x.begin(), all_x.end());
  string ans;
  for (long long i = (0); i < (all_x.size()); ++i) {
    while (ans.size() < all_x[i].first) ans += 'a';
    if (ans.size() == all_x[i].first)
      ans += t[all_x[i].second];
    else {
      int ind = ans.size() - all_x[i].first;
      if (ind < t[all_x[i].second].size()) {
        for (long long j = (ind); j < (t[all_x[i].second].size()); ++j)
          ans += t[all_x[i].second][j];
      }
    }
  }
  cout << ans;
  return 0;
}
