#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 3;
int n, k, a[N], sz[N], m;
char r[N];
string s[N];
int main() {
  scanf("%d\n", &n);
  for (int i = 1; i <= n; ++i) {
    cin >> s[i];
    sz[i] = s[i].size();
    scanf("%d", &k);
    for (int j = 0; j < k; ++j) {
      int x;
      scanf("%d", &x);
      if (!a[x] or sz[a[x]] < sz[i]) a[x] = i;
      m = max(m, x + sz[i]);
    }
  }
  for (int i = 1, j = 0, k = 0; i < m; ++i) {
    if (k >= sz[j]) j = k = 0;
    if (a[i] and sz[a[i]] > sz[j] - k) j = a[i], k = 0;
    if (!j)
      r[i] = 'a';
    else
      r[i] = s[j][k++];
  }
  printf("%s\n", r + 1);
  return 0;
}
