#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e7 + 9;
const long long mod = 1e9 + 7;
vector<bool> prime(MAX, 1);
vector<int> spf(MAX, 1);
vector<int> primes;
void sieve() {
  prime[0] = prime[1] = 0;
  spf[2] = 2;
  for (long long i = 4; i <= MAX - 1; i += 2) {
    spf[i] = 2;
    prime[i] = 0;
  }
  primes.push_back(2);
  for (long long i = 3; i <= MAX - 1; i += 2) {
    if (prime[i]) {
      primes.push_back(i);
      spf[i] = i;
      for (long long j = i * i; j <= MAX - 1; j += i) {
        prime[j] = 0;
        if (spf[j] == 1) {
          spf[j] = i;
        }
      }
    }
  }
}
long long power(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      res = res * a;
    }
    a = a * a;
    b = b >> 1;
  }
  return res;
}
long long power(long long a, long long b, long long m) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      res = (res * a) % m;
    }
    a = (a * a) % m;
    b = b >> 1;
  }
  return res % m;
}
void pre() {}
void solve() {
  int n, sz = 0;
  cin >> n;
  vector<pair<int, int>> v;
  string x;
  vector<char> res(MAX, 'a');
  for (int i = 0; i < n; i++) {
    string st;
    cin >> st;
    int k, l = st.length();
    cin >> k;
    int start = 0, f;
    for (int j = 0; j < k; j++) {
      cin >> f;
      start = max(start, f);
      for (int kt = start; kt < f + l; kt++) {
        res[kt] = st[kt - f];
      }
      start = f + l;
    }
    sz = max(sz, f + l);
  }
  for (int i = 1; i < sz; i++) {
    cout << res[i];
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  pre();
  int test_cases = 1;
  for (int i = 1; i <= test_cases; i++) {
    solve();
  }
  return 0;
}
