#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
bool Max(T1& a, T2 b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T1, typename T2>
bool Min(T1& a, T2 b) {
  return a > b ? a = b, 1 : 0;
}
const int N = 2000000;
const int M = 100001;
char a[N];
string str[M];
void solve() {
  int ns, n, v;
  vector<pair<int, int> > vec;
  cin >> ns;
  int len = 0;
  for (int i = 0; i < (ns); ++i) {
    cin >> str[i];
    cin >> n;
    while (n--) {
      cin >> v;
      v--;
      vec.emplace_back(v, i);
      Max(len, v + str[i].size());
    }
  }
  fill(a, a + len, 'a');
  sort(vec.begin(), vec.end());
  int p = 0;
  for (auto& e : vec) {
    int l = str[e.second].size();
    for (int i = max(0, p - e.first); i <= (l - 1); ++i)
      a[e.first + i] = str[e.second][i];
    Max(p, e.first + l);
  }
  for (int i = 0; i < (len); ++i) cout << a[i];
  cout << '\n';
}
void init() {}
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.setf(ios::fixed);
  cout.precision(20);
  init();
  int TC = 1;
  for (int TI = 1; TI <= (TC); ++TI) {
    solve();
  }
  return 0;
}
