#include <bits/stdc++.h>
using namespace std;
const int MAXNODES = 3e6;
int n, m, q, x, mx = 0;
string s, ans;
vector<pair<int, string>> v;
int par[MAXNODES];
void Init() {
  for (int i = 0; i < MAXNODES; ++i) par[i] = i;
}
int findleader(int i) { return par[i] == i ? i : par[i] = findleader(par[i]); }
void joinset(int i, int j) {
  int l1 = findleader(i), l2 = findleader(j);
  par[l1] = l2;
}
void solve(int i, string &k) {
  int st = findleader(i);
  int sz = k.size();
  int en = i + sz;
  while (st < en) {
    ans[st] = k[st - i];
    joinset(st, st + 1);
    st = findleader(st);
  }
}
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  Init();
  ans = string(MAXNODES, '$');
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> s >> q;
    m = s.size();
    while (q--) {
      cin >> x;
      x--;
      mx = max(mx, x + m);
      solve(x, s);
    }
  }
  for (int i = 0; i < mx; ++i)
    if (ans[i] == '$') ans[i] = 'a';
  cout << ans.substr(0, mx) << '\n';
}
