#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k, d, f;
  cin >> n;
  vector<int> s(1e7, -1);
  vector<string> x(n);
  int ma = 0;
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> k;
    for (int j = 0; j < k; ++j) {
      cin >> f;
      f--;
      int g = x[i].size();
      if (s[f] == -1 || x[i].size() > x[s[f]].size()) {
        s[f] = i;
      }
      ma = max(ma, f + g);
    }
  }
  string ans;
  int strid = -1, preid = -1;
  for (int i = 0; i < ma; ++i) {
    if (s[i] != -1) {
      if (strid == -1 || x[strid].size() + preid < x[s[i]].size() + i) {
        strid = s[i];
        preid = i;
      }
    }
    if (strid != -1) {
      if (i - preid < x[strid].size()) {
        ans.push_back(x[strid][i - preid]);
      } else {
        ans.push_back('a');
      }
    } else {
      ans.push_back('a');
    }
  }
  cout << ans << endl;
  return 0;
}
