#include <bits/stdc++.h>
using namespace std;
const long long INF = ~0ull >> 2;
const long long MAX = 100005;
const long long mod = 1e9 + 7;
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, len = 0;
  cin >> n;
  vector<pair<int, int> > v(3e6, {-1, -1});
  vector<string> s(n);
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n))) {
    cin >> s[i];
    int k;
    cin >> k;
    while (k--) {
      int x;
      cin >> x;
      len = max(len, x + int((s[i]).size()) - 1);
      pair<int, int> p = {int((s[i]).size()), i};
      if (p > v[x]) v[x] = p;
    }
  }
  pair<int, int> prev = {-1, -1};
  for (__typeof(len + 1) i = (1) - ((1) > (len + 1));
       i != (len + 1) - ((1) > (len + 1)); i += 1 - 2 * ((1) > (len + 1))) {
    v[i] = max(make_pair(prev.first - 1, prev.second), v[i]);
    if (v[i].first <= 0 || v[i].second < 0)
      cout << "a";
    else {
      int idx = v[i].second;
      cout << s[idx][int((s[idx]).size()) - v[i].first];
    }
    prev = v[i];
  }
  cout << "\n";
  return 0;
}
