#include <bits/stdc++.h>
using namespace std;
const int MAXL = 2000005;
string pat[100005];
int beg[2000005];
int bel[2000005];
int id[4200000];
int L = 0;
inline void modify(int a, int b, int val, int v = 1, int l = 1, int r = MAXL) {
  if (b < l || a > r) return;
  if (a <= l && r <= b) {
    id[v] = val;
    return;
  }
  int m = l + r >> 1;
  if (id[v]) id[v << 1] = id[v << 1 | 1] = id[v];
  id[v] = 0;
  modify(a, b, val, v << 1, l, m);
  modify(a, b, val, v << 1 | 1, m + 1, r);
  return;
}
inline int query(int p, int v = 1, int l = 1, int r = MAXL) {
  if (p < l || p > r) return 0;
  if (id[v]) return id[v];
  if (l == r) return 0;
  int m = l + r >> 1;
  return max(query(p, v << 1, l, m), query(p, v << 1 | 1, m + 1, r));
}
int cnt = 0;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> pat[i];
    int len = pat[i].size();
    int m;
    cin >> m;
    while (m--) {
      cin >> beg[++cnt];
      bel[cnt] = i;
      modify(beg[cnt], beg[cnt] + len - 1, cnt);
      L = max(L, beg[cnt] + len - 1);
    }
  }
  for (int i = 1; i <= L; ++i) {
    int q = query(i);
    if (!q)
      cout << 'a';
    else {
      cout << pat[bel[q]][i - beg[q]];
    }
  }
  cout << endl;
  return 0;
}
