#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f3f3f3f3f3f3fll;
const long long M = 1e9 + 7;
const long long maxn = 2e6 + 7;
const double eps = 0.00000001;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
template <typename T>
inline T abs(T a) {
  return a > 0 ? a : -a;
}
template <typename T>
inline T powMM(T a, T b) {
  T ret = 1;
  for (; b; b >>= 1ll, a = a * a % M) ret = 1ll * ret * a % M;
  return ret;
}
set<int> SET;
set<int>::iterator it;
int n, m, t;
int i;
int len;
int mx;
char a[maxn], s[maxn];
int main() {
  scanf("%d", &n);
  for (i = 0; i <= 2e6; i++) SET.insert(i);
  while (n--) {
    scanf("%s", s);
    len = strlen(s);
    scanf("%d", &m);
    while (m--) {
      scanf("%d", &t);
      t--;
      for (it = SET.lower_bound(t); it != SET.end() && *it < t + len;
           it = SET.lower_bound(t)) {
        a[*it] = s[*it - t];
        if (mx < *it) mx = *it;
        SET.erase(it);
      }
    }
  }
  for (i = 0; i < mx + 1; i++) {
    if (a[i])
      putchar(a[i]);
    else
      putchar('a');
  }
}
