#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18 + 7;
int main() {
  long long n;
  cin >> n;
  vector<long long> nums(1e6, 0);
  long long cnt = 0;
  vector<string> strs(n);
  vector<long long> pos;
  vector<pair<long long, long long> > p;
  p.reserve(1e6);
  for (long long i = 0; i < n; i++) {
    cin >> strs[i];
    long long c;
    cin >> c;
    for (long long j = 0; j < c; j++) {
      long long tmp;
      cin >> tmp;
      p.push_back({tmp - 1, i});
      if (nums[tmp - 1] == 0) cnt++;
      nums[tmp - 1]++;
    }
  }
  pos.resize(cnt, 0);
  cnt = 0;
  long long cur = 0;
  for (long long i = 0; i < 1e6; i++) {
    if (nums[i] > 0) {
      pos[cur] = cnt;
      cnt += nums[i];
      nums[i] = cur;
      cur++;
    }
  }
  vector<pair<long long, long long> > que(p.size());
  for (long long i = 0; i < p.size(); i++) {
    que[pos[nums[p[i].first]]] = p[i];
    pos[nums[p[i].first]]++;
  }
  long long prev = 0;
  vector<char> answ(2 * 1e6, 'a');
  for (long long i = 0; i < que.size(); i++) {
    if (que[i].first + strs[que[i].second].size() > prev) {
      for (long long j = max(prev, que[i].first);
           j < que[i].first + strs[que[i].second].size(); j++) {
        answ[j] = strs[que[i].second][j - que[i].first];
      }
      prev = que[i].first + strs[que[i].second].size();
    }
  }
  for (long long i = 0; i < prev; i++) {
    cout << answ[i];
  }
  cin >> n;
  return 0;
}
