#include <bits/stdc++.h>
using namespace std;
struct str {
  int l, r, idx;
};
bool operator<(const str& lhs, const str& rhs) {
  return tie(lhs.l, lhs.r) < tie(rhs.l, rhs.r);
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  vector<str> s(1000000);
  vector<string> v(n);
  int pos = 0;
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
    int q;
    cin >> q;
    while (q--) {
      int posl, posr;
      cin >> posl;
      posr = posl + v[i].size() - 1;
      s[pos++] = {posl, posr, i};
    }
  }
  sort(s.begin(), s.begin() + pos);
  vector<int> prefr(pos);
  for (int i = 0; i < pos; ++i)
    prefr[i] = !i ? s[i].r : max(s[i].r, prefr[i - 1]);
  for (int i = 1; i <= prefr[pos - 1]; ++i) {
    int d = distance(prefr.begin(),
                     lower_bound(prefr.begin(), prefr.begin() + pos, i));
    if (d == pos or s[d].l > i)
      cout << 'a';
    else
      cout << v[s[d].idx][i - s[d].l];
  }
}
