#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  int t;
  cin >> t;
  map<int, int> m;
  vector<string> v;
  string x = "a";
  int mi = INT_MIN;
  for (int tt = 0; tt < t; tt++) {
    string s;
    cin >> s;
    int ll = s.length();
    int n;
    cin >> n;
    v.push_back(s);
    int index;
    for (int i = 0; i < n; i++) {
      cin >> index;
      if (m.find(index - 1) == m.end()) {
        m[index - 1] = tt;
        mi = max(mi, index);
      } else if (v[m[index - 1]].length() < s.length()) {
        m[index - 1] = tt;
        mi = max(mi, index);
      }
    }
  }
  string ans = "";
  for (int i = 0; i < mi; i++) {
    if (m.find(i) == m.end()) {
      if (ans.length() <= i) ans += x;
    } else {
      if (i + v[m[i]].length() > ans.length()) {
        int xx = ans.length() - i;
        ans += v[m[i]].substr(xx);
      }
    }
  }
  cout << ans;
}
