#include <bits/stdc++.h>
using namespace std;
const int maxn = 100100;
string str[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n, len = 0;
  cin >> n;
  vector<pair<int, int> > todo;
  for (int e = 0; e < n; e++) {
    cin >> str[e];
    int gg = str[e].size();
    int cnt;
    cin >> cnt;
    for (int f = 0; f < cnt; f++) {
      int x;
      cin >> x;
      x--;
      len = max(len, x + gg);
      todo.push_back(make_pair(x, e));
    }
  }
  sort(todo.begin(), todo.end());
  queue<pair<int, int> > bb;
  string res = "";
  int ptr = 0;
  for (int e = 0; e < len; e++) {
    while (ptr < todo.size() && todo[ptr].first == e) bb.push(todo[ptr++]);
    while (!bb.empty() && bb.front().first + str[bb.front().second].size() <= e)
      bb.pop();
    if (bb.empty())
      res.push_back('a');
    else
      res.push_back(str[bb.front().second][e - bb.front().first]);
  }
  cout << res << endl;
  return 0;
}
