#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const int MAX = 2e6 + 5;
const long long MAX2 = 11;
const int MOD = 1000000000 + 7;
const long long INF = 2e18;
const int dr[] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
const int dc[] = {0, 1, 0, -1, 1, -1, 1, -1, 0};
const double pi = acos(-1);
const double EPS = 1e-9;
int n, k, x, nw, sz, p[MAX], mx;
string s;
char y[MAX];
int par(int z) {
  if (p[z] == z) return z;
  return p[z] = par(p[z]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  for (int i = 1; i <= 2000000; i++) p[i] = i;
  cin >> n;
  while (n--) {
    cin >> s >> k;
    sz = s.size() - 1;
    while (k--) {
      cin >> x;
      nw = x;
      while (nw <= x + sz) {
        y[nw] = s[nw - x];
        nw = p[nw] = par(nw + 1);
      }
      mx = max(mx, x + sz);
    }
  }
  for (int i = 1; i <= mx; i++)
    if (y[i])
      cout << (char)y[i];
    else
      cout << 'a';
  return 0;
}
