#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool chmax(T& a, const T& b) {
  return a < b ? (a = b, true) : false;
}
template <typename T>
bool chmin(T& a, const T& b) {
  return b < a ? (a = b, true) : false;
}
int N, M, K;
const int MAX_SIZE = 3000000;
vector<string> VS;
pair<int, int> acc[MAX_SIZE];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  VS.assign(N, "");
  for (int i = (int)(0); i < (int)(N); i++) {
    cin >> VS[i];
    int sz;
    cin >> sz;
    for (int j = (int)(0); j < (int)(sz); j++) {
      int x;
      cin >> x;
      chmax(acc[x - 1], make_pair(int(VS[i].size()), i));
      chmax(K, x - 1 + int(VS[i].size()));
    }
  }
  for (int i = (int)(1); i < (int)(K); i++) {
    if (acc[i - 1].first > 0) {
      chmax(acc[i], make_pair(acc[i - 1].first - 1, acc[i - 1].second));
    }
  }
  string ans(K, '.');
  for (int i = (int)(0); i < (int)(K); i++) {
    int sz = VS[acc[i].second].size();
    if (acc[i].first <= 0) {
      ans[i] = 'a';
    } else {
      ans[i] = VS[acc[i].second][sz - acc[i].first];
    }
  }
  cout << ans << endl;
  return 0;
}
