#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 100;
string s[maxn];
vector<pair<int, int> > tmp;
int main() {
  int n, k, x;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    cin >> s[i] >> k;
    for (int j = 0; j < k; j++) {
      scanf("%d", &x);
      tmp.push_back(make_pair(x, i));
    }
  }
  sort(tmp.begin(), tmp.end());
  string ans;
  int len = 1;
  for (int i = 0; i < tmp.size(); i++) {
    int t1 = tmp[i].first, t2 = tmp[i].second;
    while (t1 > len) {
      ans += 'a';
      len++;
    }
    for (int j = len - t1; j < s[t2].length(); j++) {
      ans += s[t2][j];
      len++;
    }
  }
  cout << ans << endl;
  return 0;
}
