#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<string> t(n + 1);
  vector<pair<int, vector<string>::iterator> > pos;
  int r = 0;
  for (int i = 1; i <= n; i++) {
    cin >> t[i];
    int m;
    cin >> m;
    for (int _ = 1; _ <= m; _++) {
      int j;
      cin >> j;
      pos.push_back(make_pair(j, t.begin() + i));
      r = max(r, j + (int)t[i].length() - 1);
    }
  }
  sort(pos.begin(), pos.end());
  static char s[2000005];
  auto it1 = pos.begin(), it2 = pos.begin() + 1;
  for (int i = 1; i <= r; i++) {
    while (it2 != pos.end() && it2->first <= i) {
      if (it2->first + it2->second->length() >
          it1->first + it1->second->length())
        it1 = it2;
      it2++;
    }
    if (it1->first <= i && i < it1->first + it1->second->length())
      s[i] = (*(it1->second))[i - it1->first];
    else
      s[i] = 'a';
  }
  for (int i = 1; i <= r; i++) cout << s[i];
}
