#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const int inf = (int)1e8 + 100;
const long long MAXN = 300005;
const long long MAXVAL = 10000000;
const long long INF = (long long)1e17 + 50;
const long long MOD = (long long)1e9 + 7;
const unsigned long long HASH_MOD = 2305843009213693951;
string failMessage;
void fail() {
  cout << failMessage;
  exit(0);
};
const int max_len = 3e6;
char s[max_len];
void solve() {
  int n;
  cin >> n;
  string t;
  int k;
  int m = -1;
  set<int> not_vis;
  for (int i = 0; i < n; i++) {
    cin >> t >> k;
    int start, end, x;
    for (int j = 0; j < k; j++) {
      cin >> x;
      x--;
      start = x;
      end = x + t.length() - 1;
      if (end > m) {
        for (int l = m + 1; l <= end; l++) {
          not_vis.insert(l);
          s[l] = 'a';
        }
        m = end;
      }
      vector<int> deleted;
      auto it = not_vis.lower_bound(start);
      auto it2 = not_vis.upper_bound(end);
      for (; it != it2; it++) {
        x = *it;
        deleted.push_back(x);
        s[x] = t[x - start];
      }
      for (auto e : deleted) not_vis.erase(e);
    }
  }
  for (int i = 0; i <= m; i++) cout << s[i];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.precision(15);
  solve();
  (void)0;
}
