#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
string s[maxn];
vector<pair<int, int> > v;
int main() {
  int n;
  while (~scanf("%d", &n)) {
    v.clear();
    for (int i = 1; i <= n; i++) {
      cin >> s[i];
      int nn;
      scanf("%d", &nn);
      while (nn--) {
        int x;
        scanf("%d", &x);
        v.push_back(pair<int, int>(x, i));
      }
    }
    sort(v.begin(), v.end());
    int len = 1;
    string ans;
    for (int i = 0; i < v.size(); i++) {
      int p = v[i].first, t2 = v[i].second;
      while (p > len) ans += 'a', len++;
      if (len >= p) {
        for (int j = len - p; j < s[t2].size(); j++) {
          len++;
          ans += s[t2][j];
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
