#include <bits/stdc++.h>
using namespace std;
int len[100010];
char ch[1000010], ch1[1000010], ans[1000010 << 1];
map<int, int> mp;
int main() {
  int n, k;
  scanf("%d", &n);
  int mx = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%s", ch);
    len[i] = len[i - 1];
    for (int j = 0; ch[j]; j++) ch1[++len[i]] = ch[j];
    scanf("%d", &k);
    for (int j = 1, x; j <= k; j++) {
      scanf("%d", &x);
      mx = max(mx, x);
      if (!mp.count(x))
        mp[x] = i;
      else {
        int y = mp[x];
        if (len[y] - len[y - 1] < len[i] - len[i - 1]) mp[x] = i;
      }
    }
  }
  int last = 1;
  for (int i = 1; i <= mx; i++)
    if (mp.count(i)) {
      int y = mp[i];
      last = max(last, i);
      for (; last <= i + len[y] - len[y - 1] - 1; last++)
        ans[last] = ch1[last - i + 1 + len[y - 1]];
    }
  for (int i = 1; i <= mx; i++)
    if (ans[i] == 0) ans[i] = 'a';
  printf("%s", ans + 1);
}
