#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  vector<pair<long long int, long long int> > v;
  vector<string> s(n);
  for (long long int i = 0; i < n; i++) {
    cin >> s[i];
    long long int k;
    cin >> k;
    while (k--) {
      long long int x;
      cin >> x;
      v.push_back({x - 1, i});
    }
  }
  sort(v.begin(), v.end());
  n = v.size();
  string str(2000003, 'a');
  long long int prev = 0;
  for (long long int i = 0; i < n; i++) {
    if (prev > v[i].first) {
      if (prev >= v[i].first + s[v[i].second].length())
        continue;
      else {
        for (long long int j = prev + 1;
             j < v[i].first + s[v[i].second].length(); j++)
          str[j] = s[v[i].second][j - v[i].first];
        prev = v[i].first + s[v[i].second].length() - 1;
      }
    } else {
      for (long long int j = v[i].first;
           j < v[i].first + s[v[i].second].length(); j++)
        str[j] = s[v[i].second][j - v[i].first];
      prev = v[i].first + s[v[i].second].length() - 1;
    }
  }
  for (long long int i = 0; i <= prev; i++) cout << str[i];
  return 0;
}
