#include <bits/stdc++.h>
using namespace std;
inline int Set(int N, int pos) { return N = N | (1 << pos); }
inline int reset(int N, int pos) { return N = N & ~(1 << pos); }
inline bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
int dx[] = {+1, -1, 0, 0};
int dy[] = {0, 0, +1, -1};
int dx2[] = {+1, -1, 0, 0, +1, +1, -1, -1};
int dy2[] = {0, 0, +1, -1, +1, -1, -1, +1};
inline long long int squ(long long int x) { return (x * x); }
inline long long int power(long long int bs, long long int k) {
  long long int x = 1LL, y = bs;
  if (k == 0) return 1LL;
  while (k > 0) {
    if (k % 2) x *= y;
    y *= y;
    k /= 2;
  }
  return x;
}
string s[1000100];
int ps[1000100], ln[1000100], nxt[1000100];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cout.unsetf(ios::floatfield);
  cout.precision(6);
  cout.setf(ios::fixed, ios::floatfield);
  ;
  int i, j, n, x, p, k, mxln = -1;
  memset(ps, -1, sizeof(ps));
  memset(ln, 0, sizeof(ln));
  cin >> n;
  vector<int> qq;
  for (i = 0; i < n; i++) {
    cin >> s[i];
    cin >> x;
    for (j = 0; j < x; j++) {
      cin >> p;
      if (s[i].size() > ln[p]) {
        ps[p] = i;
        ln[p] = s[i].size();
      }
      qq.push_back(p);
    }
  }
  sort(qq.begin(), qq.end());
  unique(qq.begin(), qq.end());
  string ans;
  for (i = 1; i < qq[0]; i++) ans += 'a';
  int sz = qq.size(), nxt = qq[0];
  for (i = 0; i < sz; i++) {
    for (j = max(nxt, qq[i]); j < qq[i] + ln[qq[i]]; j++) {
      ans += s[ps[qq[i]]][j - qq[i]];
    }
    nxt = max(nxt, qq[i] + ln[qq[i]]);
    if (i < sz - 1)
      for (j = nxt; j < qq[i + 1]; j++) ans += 'a';
  }
  cout << ans;
  return 0;
}
