#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > A;
vector<string> str;
int main() {
  int n;
  string s;
  int x;
  int k;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s >> k;
    str.push_back(s);
    int l = s.length();
    for (int j = 0; j < k; j++) {
      scanf("%d", &x);
      A.push_back(make_pair(x - 1, i));
    }
  }
  sort(A.begin(), A.end());
  int pos = 0;
  for (int i = 0; i < A.size(); i++) {
    int p = A[i].second;
    if (pos >= A[i].first + str[p].length()) continue;
    while (pos < A[i].first) {
      printf("a");
      pos++;
    }
    while (pos < A[i].first + str[p].length()) {
      printf("%c", str[p][pos - A[i].first]);
      pos++;
    }
  }
}
