#include <bits/stdc++.h>
using namespace std;
vector<string> s(100005);
vector<pair<pair<int, int>, int> > a;
bool comp(pair<pair<int, int>, int> x, pair<pair<int, int>, int> y) {
  return x.first.first == y.first.first ? x.first.second > y.first.second
                                        : x.first.first < y.first.first;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, ma = 0;
  cin >> n;
  for (__typeof((n)) i = (0); i < (n); i += 1) {
    cin >> s[i];
    int k;
    cin >> k;
    int si = s[i].size();
    for (__typeof((k)) j = (0); j < (k); j += 1) {
      int x;
      cin >> x;
      a.push_back(make_pair(make_pair(x - 1, x + si - 2), i));
      ma = ((ma) > (x + si) ? (ma) : (x + si));
    }
  }
  sort(a.begin(), a.begin() + a.size(), comp);
  int start = 0, end;
  int i = 0;
  string ans = "";
  int oi = a.size();
  while (start < ma) {
    if (i == oi) {
      break;
    }
    if (start == a[i].first.first) {
      end = a[i].first.second;
      ans += s[a[i].second];
      start = end + 1;
    } else if (start < a[i].first.first) {
      start++;
      ans += 'a';
    } else if (start > a[i].first.second) {
      i++;
    } else {
      end = a[i].first.second;
      int l = s[a[i].second].size(), r = end - start + 1;
      for (__typeof((l)) j = (l - r); j < (l); j += 1) {
        ans += s[a[i].second][j];
      }
      start = end + 1;
    }
  }
  cout << ans;
}
