#include <bits/stdc++.h>
using namespace std;
int n, mx;
int ans[10000000];
vector<string> vec;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  vec.push_back("");
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    vec.push_back(s);
    int m;
    cin >> m;
    for (int j = 0; j < m; j++) {
      int pos;
      cin >> pos;
      mx = max(mx, pos);
      pos--;
      if (vec[ans[pos]].size() < s.size()) ans[pos] = i + 1;
    }
  }
  string s;
  int it = 0;
  int num = 0;
  for (int i = 0; i < mx || it != vec[num].size(); i++) {
    if (i >= mx) {
      s += vec[num][it];
      it++;
      continue;
    }
    int len = vec[num].size() - it;
    if (vec[ans[i]].size() > len) {
      num = ans[i];
      it = 0;
    }
    if (vec[num].size() - it == 0)
      s += 'a';
    else
      s += vec[num][it++];
  }
  cout << s << endl;
}
