#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<string> str(n);
  vector<pair<int, int> > v;
  int i = 0;
  for (auto &s : str) {
    cin >> s;
    int k;
    cin >> k;
    for (int j = 0; j < k; j++) {
      int pos;
      cin >> pos;
      pos--;
      v.push_back(make_pair(pos, i));
    }
    i++;
  }
  sort(v.begin(), v.end());
  string ans;
  int cnt = 0;
  for (pair<int, int> p : v) {
    int pos = p.first;
    while (cnt < pos) ans += "a", cnt++;
    int slen = cnt - pos;
    for (i = slen; i < (int)str[p.second].size(); i++) {
      ans += str[p.second][i];
      cnt++;
    }
  }
  cout << ans << endl;
}
