#include <bits/stdc++.h>
using namespace std;
int n;
string t[100005];
vector<int> pos[100005];
string ret;
int par[2000000];
int par_find(int v) { return par[v] == v ? v : par[v] = par_find(par[v]); }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  int sz = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> t[i];
    int kk;
    cin >> kk;
    while (kk--) {
      int xx;
      cin >> xx;
      xx--;
      pos[i].push_back(xx);
      sz = max(sz, (int)xx + (int)t[i].size());
    }
  }
  for (int i = 0; i <= sz; ++i) par[i] = i;
  while (sz--) ret += "a";
  for (int i = 1; i <= n; ++i) {
    for (int cur : pos[i]) {
      int st = cur;
      st = par_find(cur);
      while (st < cur + (int)t[i].size()) {
        ret[st] = t[i][st - cur];
        par[st] = par_find(st + 1);
        st = par[st];
      }
    }
  }
  cout << ret << endl;
}
