#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(0);
  int n;
  cin >> n;
  vector<pair<string, int>> v(n);
  vector<pair<int, int>> p;
  vector<int> s(2010101, 1000010000);
  int len = 0;
  for (int i = 0; i < n; ++i) {
    int k;
    cin >> v[i].first >> k;
    v[i].second = i;
    for (int j = 0; j < k; ++j) {
      int x;
      cin >> x;
      --x;
      len = max(len, x + (int)(v[i].first).size());
      p.push_back({x, i});
    }
  }
  sort((p).begin(), (p).end());
  int pos = 0;
  for (int i = 0; i < (p).size(); ++i) {
    auto e = p[i];
    if (e.first + (v[e.second].first).size() <= pos) {
      continue;
    }
    if (pos < e.first) pos = e.first;
    int b = pos - e.first;
    for (int j = b; j < (v[e.second].first).size(); ++j) {
      s[pos] = v[e.second].first[j];
      ++pos;
    }
  }
  for (int i = 0; i < len; ++i) {
    char c = s[i] == 1000010000 ? 'a' : s[i];
    cout << c;
  }
  return 0;
}
