#include <bits/stdc++.h>
using namespace std;
string ans;
int main() {
  long long n;
  cin >> n;
  vector<pair<long long, long long> > vec;
  string s[n + 1];
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    int k;
    cin >> k;
    for (int j = 0; j < k; j++) {
      int c;
      cin >> c;
      vec.push_back({c, i});
    }
  }
  sort(vec.begin(), vec.end());
  int pos = 1, j;
  for (int i = 0; i < vec.size(); i++) {
    long long x = vec[i].first;
    long long y = vec[i].second;
    while (x > pos) {
      ans += "a";
      pos++;
    }
    int r = 0;
    for (j = pos - x; j < s[y].size(); j++) {
      ans += s[y][j];
      pos++;
    }
  }
  cout << ans << endl;
  return 0;
}
