#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 2e6 + 42;
string c[N];
int ps[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  memset(ps, -1, sizeof(ps));
  int n = 0;
  cin >> n;
  int sz = 0;
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    int cz = c[i].size();
    int k = 0;
    cin >> k;
    for (int j = 0; j < k; j++) {
      int x;
      cin >> x;
      x--;
      sz = max(sz, x + cz);
      ps[x] = (ps[x] == -1 ? i : (c[ps[x]].size() >= cz ? ps[x] : i));
    }
  }
  string cur;
  int cpos = -1, curs = -1;
  for (int i = 0; i < sz; i++) {
    if (ps[i] != -1) {
      if (cpos == -1) {
        cpos = 0;
        curs = ps[i];
      } else if (c[ps[i]].size() > c[curs].size() - cpos) {
        cpos = 0;
        curs = ps[i];
      }
    }
    if (cpos == -1)
      cout << 'a';
    else {
      cout << c[curs][cpos++];
      if (cpos == c[curs].size()) cpos = -1;
    }
  }
  return 0;
}
