#include <bits/stdc++.h>
using namespace std;
const int _ = 1e2;
const int maxn = 2e6 + _;
const int mod = 998244353;
inline int ad(int x, int y) { return x >= mod - y ? x - mod + y : x + y; }
inline int re(int x, int y) { return x < y ? x - y + mod : x - y; }
inline int mu(int x, int y) { return (long long)x * y % mod; }
inline int qp(int x, long long y) {
  int r = 1;
  while (y) {
    if (y & 1) r = mu(r, x);
    x = mu(x, x);
    y >>= 1;
  }
  return r;
}
inline int iv(int x) { return qp(x, mod - 2); }
inline int dv(int x, int y) { return mu(x, qp(y, mod - 2)); }
inline int gcd(int x, int y) { return x ? gcd(y % x, x) : y; }
int a[maxn];
char ss[maxn];
set<int> S;
set<int>::iterator it, jt, kt;
int main() {
  int n, mx = 0;
  scanf("%d", &n);
  for (int i = 0; i <= 2000001; i++) S.insert(i);
  for (int i = 1; i <= n; i++) {
    int len;
    scanf("%s", ss + 1);
    len = strlen(ss + 1);
    int m, l, r;
    scanf("%d", &m);
    for (int j = 1; j <= m; j++) {
      scanf("%d", &l), r = l + len - 1;
      mx = max(mx, r);
      it = S.lower_bound(l), jt = S.lower_bound(r + 1);
      for (kt = it; kt != jt;) a[*kt] = ss[(*kt) - l + 1] - 'a', S.erase(kt++);
    }
  }
  for (int i = 1; i <= mx; i++) printf("%c", 'a' + a[i]);
  return 0;
}
