#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 7;
int n, mx[N], id[N];
string t[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  int last = 0;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    t[i] = s;
    int k;
    cin >> k;
    while (k--) {
      int x;
      cin >> x;
      last = max(last, x);
      if (s.size() > mx[x]) {
        mx[x] = s.size();
        id[x] = i;
      }
    }
  }
  string s = "";
  int j = 1;
  for (int i = 1; i <= last; i++) {
    if (mx[i] == 0) {
      if (i == j) {
        j++;
        s.push_back('a');
      }
    } else {
      if (i + mx[i] > j) {
        while (i + mx[i] > j) {
          int k = j - i;
          s.push_back(t[id[i]][k]);
          j++;
        }
      }
    }
  }
  cout << s << "\n";
  return 0;
}
