#include <bits/stdc++.h>
using namespace std;
const int MX = 2000010;
int f[MX];
char c1[MX], c2[MX];
int getf(int x) {
  if (f[x] == x)
    return x;
  else
    return f[x] = getf(f[x]);
}
int main() {
  int n, i, j, k, t, ma = 0;
  for (i = 0; i <= MX; i++) f[i] = i;
  scanf("%d", &n);
  memset(c1, 'a', sizeof(c1));
  for (i = 0; i < n; i++) {
    scanf("%s %d", c2, &k);
    int s = strlen(c2);
    for (j = 1; j <= k; j++) {
      scanf("%d", &t);
      ma = max(ma, t + s);
      int h = getf(t);
      int w = h - t;
      while (h < t + s) {
        f[h] = getf(h + 1);
        c1[h++] = c2[w++];
      }
    }
  }
  for (i = 1; i < ma; i++) printf("%c", c1[i]);
  printf("\n");
  return 0;
}
