#include <bits/stdc++.h>
using namespace std;
struct line {
  int l, r, id;
};
int n, m;
vector<line> f;
char inp[2000005];
int len = 0;
char res[5000005];
bool cmp(line a, line b) {
  if (a.l == b.l) return a.r < b.r;
  return a.l < b.r;
}
int main() {
  for (int i = 1; i <= 5000000; i++) res[i] = ' ';
  len = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", &inp);
    scanf("%d", &m);
    int leng = strlen(inp);
    int u = 1;
    while (m--) {
      int x;
      scanf("%d", &x);
      for (u = max(x, u); u < x + leng; u++) res[u] = inp[u - x];
      len = max(len, x + leng - 1);
    }
  }
  for (int i = 1; i <= len; i++) {
    if (res[i] == ' ') res[i] = 'a';
  }
  for (int i = 1; i <= len; i++) printf("%c", res[i]);
  puts("");
  return 0;
}
