#include <bits/stdc++.h>
struct Data {
  std::vector<int> nums;
  std::string str;
};
struct Interval {
  int start;
  int end;
  std::string* data;
};
bool compareIntervals(const Interval& a, const Interval& b) {
  if (a.start < b.start) return true;
  if (a.start > b.start) return false;
  return a.end < b.end;
}
int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);
  int numSteps;
  std::cin >> numSteps;
  size_t finalLength = 0;
  std::vector<Data> steps(numSteps);
  int numIntervals = 0;
  for (int i = 0; i < steps.size(); ++i) {
    std::cin >> steps[i].str;
    int occurrences;
    std::cin >> occurrences;
    steps[i].nums.resize(occurrences);
    numIntervals += occurrences;
    for (int k = 0; k < occurrences; ++k) std::cin >> steps[i].nums[k];
    finalLength =
        std::max(finalLength, steps[i].nums.back() - 1 + steps[i].str.size());
  }
  std::vector<Interval> intervals(numIntervals);
  int intervalsIdx = 0;
  for (int i = 0; i < steps.size(); ++i) {
    for (int j = 0; j < steps[i].nums.size(); ++j) {
      Interval& curr = intervals[intervalsIdx];
      curr.start = steps[i].nums[j] - 1;
      curr.end = curr.start + steps[i].str.size();
      curr.data = &steps[i].str;
      ++intervalsIdx;
    }
  }
  std::sort(intervals.begin(), intervals.end(), compareIntervals);
  std::string out(finalLength, 'a');
  int doneIdx = 0;
  for (int i = 0; i < intervals.size(); ++i) {
    for (int idx = std::max(doneIdx, intervals[i].start);
         idx < intervals[i].end; ++idx) {
      out[idx] = (*intervals[i].data)[idx - intervals[i].start];
    }
    doneIdx = std::max(doneIdx, intervals[i].end);
  }
  std::cout << out << '\n';
  return 0;
}
