#include <bits/stdc++.h>
using namespace std;
const int mx = 3e6 + 100;
int n, m, q, f[mx];
char str[mx], ans[mx];
int find(int x) { return x == f[x] ? x : f[x] = find(f[x]); }
int main() {
  while (~scanf("%d", &n)) {
    memset(ans, 'a', sizeof(ans));
    for (int i = 1; i < mx; i++) f[i] = i;
    int maxx = 0;
    while (n--) {
      scanf("%s%d", str, &m);
      int len = strlen(str);
      while (m--) {
        scanf("%d", &q);
        maxx = max(q + len, maxx);
        for (int i = find(q); i < q + len; i = f[i] = find(i + 1))
          ans[i] = str[i - q];
      }
    }
    ans[maxx] = '\0';
    puts(ans + 1);
  }
  return 0;
}
