#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2e6 + 5;
const long long INF = 1e5;
struct s {
  string mystr;
  long long k;
  vector<long long> v;
} save[MAXN];
long long n, ok[MAXN], m;
char ans[MAXN];
string strs[MAXN];
void findok() {
  for (long long i = 1; i <= n; i++) {
    long long len = save[i].mystr.size();
    for (long long j = 0; j < save[i].v.size(); j++) {
      long long p = save[i].v[j];
      if (len > save[ok[p]].mystr.size()) {
        ok[p] = i;
      }
      m = max(p + len - 1, m);
    }
  }
}
void solve() {
  long long pre = 1;
  for (long long i = 1; i <= m; i++) {
    if (ok[i]) {
      long long len = save[ok[i]].mystr.size();
      long long st = pre - i;
      for (long long j = pre; j <= i + len - 1; j++) {
        ans[j] = save[ok[i]].mystr[st++];
      }
      pre = max(pre, i + len);
    } else {
      if (!ans[i]) {
        ans[i] = 'a';
        pre++;
      }
    }
  }
  for (long long i = 1; i <= m; i++) {
    printf("%c", ans[i]);
  }
}
int main() {
  while (~scanf("%lld", &n)) {
    for (long long i = 1; i <= n; i++) {
      cin >> save[i].mystr;
      scanf("%lld", &save[i].k);
      for (long long j = 1; j <= save[i].k; j++) {
        long long x;
        scanf("%lld", &x);
        save[i].v.push_back(x);
      }
    }
    findok();
    solve();
  }
}
