#include <bits/stdc++.h>
using namespace std;
char s[2000005], str[2000005];
int pre[2000005];
int find(int x) { return x == pre[x] ? x : pre[x] = find(pre[x]); }
int main() {
  int n, q, x;
  while (scanf("%d", &n) != EOF) {
    for (int i = 1; i < 2000005; i++) pre[i] = i;
    int maxx = 0;
    while (n--) {
      scanf("%s%d", str, &q);
      int len = strlen(str);
      while (q--) {
        scanf("%d", &x);
        maxx = max(maxx, x + len);
        for (int i = find(x); i < x + len; i = pre[i] = find(i + 1))
          s[i] = str[i - x];
      }
    }
    for (int i = 1; i < maxx; i++) {
      if (s[i] == '\0') s[i] = 'a';
    }
    printf("%s", s + 1);
  }
  return 0;
}
