#include <bits/stdc++.h>
using namespace std;
template <class BidirIt>
BidirIt prev(BidirIt it,
             typename iterator_traits<BidirIt>::difference_type n = 1) {
  advance(it, -n);
  return it;
}
template <class ForwardIt>
ForwardIt next(ForwardIt it,
               typename iterator_traits<ForwardIt>::difference_type n = 1) {
  advance(it, n);
  return it;
}
const double EPS = 1e-9;
const double PI = 3.141592653589793238462;
template <typename T>
inline T sq(T a) {
  return a * a;
}
const int MAXN = 1e5 + 5;
const int SIZE = 2e6 + 100;
string t[MAXN];
vector<int> pos[MAXN];
char ans[SIZE];
int which[SIZE];
int main() {
  int n, sz = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int k;
    cin >> t[i] >> k;
    pos[i].resize(k);
    for (int j = 0; j < k; j++) {
      scanf("%d", &pos[i][j]);
      if (t[i].size() > t[which[pos[i][j]]].size()) which[pos[i][j]] = i;
      sz = max(sz, pos[i][j] + (int)t[i].size() - 1);
    }
  }
  int pos = 0, who = 0;
  for (int i = 1; i <= sz; i++) {
    if ((int)t[who].size() - pos < (int)t[which[i]].size()) {
      who = which[i];
      pos = 0;
    }
    if (pos < (int)t[who].size()) {
      ans[i] = t[who][pos];
      pos++;
    } else {
      ans[i] = 'a';
    }
  }
  puts(ans + 1);
  return 0;
}
