#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6 + 5;
int n, m, pos_id[MAX << 1];
string ss[100010];
char ans[MAX << 1], tmp[MAX];
int main() {
  int t, i, j, k, cnt, p, len = 0;
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> ss[i];
    cin >> cnt;
    for (; cnt; cnt--) {
      cin >> p;
      len = max(len, int(p + ss[i].size() - 1));
      if (!pos_id[p] || ss[pos_id[p]].size() < ss[i].size()) pos_id[p] = i;
    }
  }
  int mx = 0, cur = 0;
  for (i = 1; i <= len; i++) {
    if (pos_id[i] && (!cur || (i + ss[pos_id[i]].size() - 1 > mx))) {
      j = 0;
      cur = pos_id[i];
      mx = (i + ss[pos_id[i]].size()) - 1;
    }
    if (i <= mx)
      ans[i] = ss[cur][j++];
    else
      ans[i] = 'a';
  }
  ans[len + 1] = 0;
  cout << ans + 1 << endl;
  return 0;
}
