#include <bits/stdc++.h>
using namespace std;
int n;
char s[2000010];
int fa[2000010], rend[2000010];
int findfa(int p) {
  if (fa[p] != p) fa[p] = findfa(fa[p]);
  return fa[p];
}
void uni(int p, int q) {
  p = findfa(p), q = findfa(q);
  fa[p] = q;
  rend[q] = max(rend[q], rend[p]);
}
char tmp[2000010];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= 2000010 - 5; i++) {
    fa[i] = i;
    rend[i] = i;
  }
  while (n--) {
    scanf("%s", tmp + 1);
    int len = strlen(tmp + 1);
    int t;
    scanf("%d", &t);
    while (t--) {
      int sp;
      scanf("%d", &sp);
      int cur = rend[findfa(sp)];
      while (cur != 2000010 - 5 && cur - sp < len) {
        s[cur] = tmp[cur - sp + 1];
        uni(cur, cur + 1);
        cur = rend[findfa(cur)];
      }
    }
  }
  int lst = 2000010 - 5;
  while (!s[lst]) lst--;
  for (int i = 1; i <= lst; i++)
    if (!s[i])
      putchar('a');
    else
      putchar(s[i]);
  return 0;
}
