#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  std::vector<std::vector<int>> starts(int(1e6));
  std::vector<std::string> t(n);
  int len = 0;
  for (int i = 0; i < n; ++i) {
    cin >> t[i];
    int m;
    cin >> m;
    for (int j = 0; j < m; ++j) {
      int pos;
      cin >> pos;
      --pos;
      starts[pos].push_back(i);
      len = std::max<int>(len, pos + int(t[i].size()));
    }
  }
  std::string result(len, 'a');
  starts.resize(len);
  int maxRight = -1;
  int nowStr = -1;
  int nowStrInd = -1;
  for (int i = 0; i < len; ++i) {
    for (const auto& s : starts[i]) {
      if ((i + int(t[s].size())) > maxRight) {
        maxRight = i + t[s].size();
        nowStr = s;
        nowStrInd = 0;
      }
    }
    if (nowStr != -1) {
      result[i] = t[nowStr][nowStrInd++];
      if (nowStrInd >= t[nowStr].size()) {
        nowStrInd = -1;
        nowStr = -1;
      }
    }
  }
  std::cout << result << std::endl;
  return 0;
}
