#include <bits/stdc++.h>
int a[2111111];
char str[2111111];
int vis[2111111];
int main() {
  int n, maxx = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", str);
    int m, len = strlen(str);
    scanf("%d", &m);
    for (int j = 0, x; j < m; j++) {
      scanf("%d", &x);
      maxx = maxx > x + len - 1 ? maxx : x + len - 1;
      for (int k = 0; k < len; k++) {
        if (!vis[k + x]) {
          a[k + x] = str[k] - 'a';
          vis[k + x] = len - k;
        } else {
          int temp = vis[k + x];
          vis[k + x] = vis[k + x] > len - k ? vis[k + x] : len - k;
          k += temp - 1;
        }
      }
    }
  }
  for (int i = 1; i <= maxx; i++) {
    printf("%c", a[i] + 'a');
  }
  printf("\n");
}
