#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 10;
char s[N], t[N];
int n, k, x, ans;
int main() {
  memset(s, 'a', sizeof(s));
  int i, j, r = 0;
  scanf("%d", &n);
  while (n--) {
    scanf("%s %d", t, &k);
    int len = strlen(t);
    int pre = -len;
    for (i = 0; i < k; ++i) {
      scanf("%d", &x);
      for (j = max(0, len - (x - pre)); j < len; ++j) s[j + x - 1] = t[j];
      pre = x;
      r = max(r, x + len - 1);
    }
  }
  for (i = 0; i < r; ++i) printf("%c", s[i]);
  puts("");
  return 0;
}
