#include <bits/stdc++.h>
using namespace std;
const int N = 5000005;
long long int parent[N];
long long int getparent(long long int k) {
  while (k != parent[k]) {
    parent[k] = parent[parent[k]];
    k = parent[k];
  }
  return k;
}
void solve() {
  for (long long int i = 0; i < N; i++) parent[i] = i;
  long long int n;
  cin >> n;
  long long int len = 0;
  string s[n];
  vector<long long int> v[n];
  for (long long int i = 0, x; i < n; i++) {
    cin >> s[i] >> x;
    long long int sz = s[i].size() - 1;
    for (long long int j = 0, val; j < x; j++) {
      cin >> val;
      val--;
      v[i].push_back(val);
      len = max(len, val + sz);
    }
  }
  len++;
  string ans;
  for (long long int i = 0; i < len; i++) ans += 'a';
  for (long long int i = 0; i < n; i++) {
    long long int sz = s[i].size();
    for (auto X : v[i]) {
      long long int nxt_free = getparent(X);
      if (nxt_free >= len) continue;
      long long int dif = nxt_free - X;
      if (sz > dif) {
        long long int end = X + sz;
        for (long long int j = nxt_free; j < end; j++) {
          ans[j] = s[i][j - X];
          parent[j] = end;
        }
      }
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  srand(time(NULL));
  ;
  long long int t = 1;
  while (t--) {
    solve();
  }
}
