#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  multimap<int, int> info;
  int result_size = 0;
  vector<string> substrs;
  for (int i = 0; i < n; ++i) {
    string str;
    int k;
    cin >> str >> k;
    substrs.push_back(str);
    for (int j = 0; j < k; ++j) {
      int num;
      cin >> num;
      --num;
      info.insert(make_pair(num, i));
      if (j == k - 1)
        result_size = std::max(result_size, static_cast<int>(str.size()) + num);
    }
  }
  string result(result_size, 'a');
  char* result_data = const_cast<char*>(result.c_str());
  int last_pos = -1;
  for (auto iter = info.begin(); iter != info.end(); ++iter) {
    const pair<int, int>& p = *iter;
    if (p.first + static_cast<int>(substrs[p.second].size()) - 1 > last_pos) {
      if (p.first <= last_pos) {
        int offset = last_pos - p.first + 1;
        std::copy_n(substrs[p.second].c_str() + offset,
                    substrs[p.second].size() - offset,
                    result_data + p.first + offset);
      } else
        std::copy_n(substrs[p.second].c_str(), substrs[p.second].size(),
                    result_data + p.first);
      last_pos = p.first + substrs[p.second].size() - 1;
    }
  }
  cout << result << "\n";
  return 0;
}
