#include <bits/stdc++.h>
using namespace std;
string s[100010];
pair<int, int> a[1000010];
char ans[2000010];
bool mark[2000010];
int main() {
  int n, siz = 0, k, x, pt = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    scanf("%d", &k);
    for (int j = 0; j < k; j++) {
      scanf("%d", &x);
      a[siz++] = make_pair(x, i);
    }
  }
  sort(a, a + siz);
  for (int i = 0; i < siz; i++) {
    if (a[i].first + s[a[i].second].size() - 1 >= pt) {
      if (a[i].first > pt) pt = a[i].first;
      int temp = pt;
      for (int j = temp - a[i].first; j < s[a[i].second].size(); j++) {
        ans[pt] = s[a[i].second][j];
        mark[pt++] = true;
      }
    }
  }
  for (int i = 1; i < pt; i++) {
    if (!mark[i])
      cout << "a";
    else
      cout << ans[i];
  }
}
