#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
string s[maxn];
int len[maxn];
int flag[maxn * 2];
int main() {
  int n, k, t;
  int maxlen = 0;
  int now = 0;
  int mapn = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
    len[i] = s[i].size();
    scanf("%d", &k);
    while (k--) {
      scanf("%d", &t);
      if (!flag[t] || len[flag[t]] < len[i]) flag[t] = i;
      maxlen = max(len[i] + t - 1, maxlen);
    }
  }
  for (int i = 1; i <= maxlen; i++) {
    if (flag[i] && len[flag[i]] > mapn) {
      now = flag[i];
      mapn = len[flag[i]];
    }
    printf("%c", mapn ? s[now][len[now] - mapn--] : 'a');
  }
  return 0;
}
