#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000011;
const int MAXL = 5000011;
int n, m, N, k, father[MAXL];
char s[MAXL], ch[MAXL];
bool ok[MAXL];
inline int find(int x) {
  if (father[x] != x) father[x] = find(father[x]);
  return father[x];
}
inline void work() {
  scanf("%d", &n);
  int x;
  for (int i = 1; i < MAXL; i++) father[i] = i;
  while (n--) {
    scanf("%s", ch);
    scanf("%d", &k);
    m = strlen(ch);
    while (k--) {
      scanf("%d", &x);
      if (x + m - 1 >= N) N = x + m - 1;
      for (int i = x; i < x + m; father[i] = find(i + 1), i = father[i]) {
        ok[i] = true;
        s[i] = ch[i - x];
      }
    }
  }
  for (int i = 1; i <= N; i++)
    if (ok[i])
      printf("%c", s[i]);
    else
      printf("a");
}
int main() {
  work();
  return 0;
}
