#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2000005;
char str[MAXN], s[MAXN];
int main() {
  int n;
  scanf("%d", &n);
  int maxLen = -1;
  while (n--) {
    scanf("%s", str + 1);
    int len = strlen(str + 1);
    int k;
    scanf("%d", &k);
    int last = 1;
    for (int i = 1; i <= k; i++) {
      int p;
      scanf("%d", &p);
      for (int j = max(last, p); j <= p + len - 1; j++) {
        s[j] = str[j - p + 1];
        maxLen = max(maxLen, j);
      }
      last = p + len;
    }
  }
  for (int i = 1; i <= maxLen; i++) {
    if (s[i]) {
      putchar(s[i]);
    } else {
      putchar('a');
    }
  }
  putchar('\n');
  return 0;
}
