#include <bits/stdc++.h>
using namespace std;
const int N = 1e7 + 10;
int n;
vector<string> a;
vector<pair<pair<int, int>, int> > pos;
char s[N];
int main() {
  scanf("%d", &n);
  for (int i = (0); i < (n); i++) {
    int m;
    string t;
    cin >> t;
    a.push_back(t);
    scanf("%d", &m);
    for (int j = (0); j < (m); j++) {
      int at;
      scanf("%d", &at);
      at--;
      pos.push_back(make_pair(make_pair(at, -(int)a[i].size()), i));
    }
  }
  sort(pos.begin(), pos.end());
  int p = 0;
  for (int i = (0); i < ((int)pos.size()); i++) {
    int at = pos[i].first.first, len = -pos[i].first.second, id = pos[i].second;
    while (p < at) s[p++] = 'a';
    if (p >= at && p < at + len) {
      for (int j = (p - at); j < (len); j++) s[p++] = a[id][j];
    }
  }
  printf("%s\n", s);
  return 0;
}
