#include <bits/stdc++.h>
using namespace std;
const int N = 1100001;
const int M = 6666666;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-7;
int n;
char ss[10000050];
char t[1000005];
int f[10000050];
int find1(int u) { return u == f[u] ? u : f[u] = find1(f[u]); }
int main() {
  for (int i = 0; i <= 10000050; i++) f[i] = i;
  scanf("%d", &n);
  int cnt;
  int mmax = 0;
  int index;
  for (int i = 0; i < n; i++) {
    scanf("%s %d", t, &cnt);
    int len = strlen(t);
    while (cnt--) {
      scanf("%d", &index);
      for (int j = find1(index); j < len + index; j = f[j] = find1(j + 1)) {
        ss[j] = t[j - index];
      }
      mmax = max(mmax, index + len);
    }
  }
  for (int i = 1; i < mmax; i++)
    if (ss[i] == '\0') ss[i] = 'a';
  puts(ss + 1);
  return 0;
}
