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