#include <bits/stdc++.h>
using namespace std;
string str[100000 + 10];
vector<pair<pair<int, int>, int> > v;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> str[i];
    int sz = str[i].size();
    int k;
    cin >> k;
    for (int j = 1; j <= k; j++) {
      int x;
      cin >> x;
      v.push_back(make_pair(make_pair(x, x + sz - 1), i));
    }
  }
  sort(v.begin(), v.end());
  string ans = "";
  int mx = 0;
  for (auto it : v) {
    int l = it.first.first, r = it.first.second, ind = it.second;
    int sz = r - l + 1;
    if (l > mx) {
      for (int j = mx + 1; j < l; j++) {
        ans += 'a';
      }
      ans += str[ind];
      mx = r;
    } else if (r <= mx) {
      continue;
    } else if (r > mx) {
      int start = mx + 1 - l;
      for (int j = start; j < sz; j++) {
        ans += str[ind][j];
      }
      mx = r;
    }
  }
  cout << ans << "\n";
}
