#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int maxn = 3e6 + 7;
int n;
char ans[maxn];
string s[maxn];
int pos[maxn], which[maxn], len[maxn], last;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
    int t;
    scanf("%d", &t);
    len[i] = s[i].size();
    while (t--) {
      int v;
      scanf("%d", &v);
      if (len[i] > pos[v]) {
        pos[v] = len[i];
        which[v] = i;
      }
      last = max(last, v + len[i] - 1);
    }
  }
  ans[last + 1] = '\0';
  int cur = 1;
  for (int i = 1; i <= last; i++) {
    int who = i;
    if (!pos[i]) continue;
    if (cur < i) cur = i;
    while (i + pos[i] > cur && cur <= last) {
      ans[cur] = s[which[who]][cur - i];
      cur++;
    }
  }
  for (int i = 1; i <= last; i++)
    if (!ans[i]) ans[i] = 'a';
  puts(ans + 1);
  return 0;
}
