#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
vector<pair<int, int>> a;
string s[N];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int k, x;
    cin >> s[i] >> k;
    for (int j = 1; j <= k; j++) {
      cin >> x;
      a.push_back(make_pair(x, i));
    }
  }
  sort(a.begin(), a.end());
  string ans = "";
  int pos = 1;
  for (int i = 0; i < a.size(); i++) {
    while (a[i].first > pos) {
      ans += 'a';
      pos++;
    }
    while (pos <= a[i].first + s[a[i].second].size() - 1) {
      ans += s[a[i].second][pos - a[i].first];
      pos++;
    }
  }
  cout << ans << endl;
  return 0;
}
