#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e6 + 5;
int main() {
  char a[maxn] = {};
  int n, k, i;
  cin >> n;
  while (n--) {
    string x;
    cin >> x >> k;
    int t, len = x.size(), tt = -len;
    while (k--) {
      cin >> t;
      for (i = max(0, tt + len - t); i < len; i++) a[i + t] = x[i];
      tt = t;
    }
  }
  for (i = maxn - 1; !a[i];) i--;
  for (int j = 1; j <= i; j++) putchar(a[j] ? a[j] : 'a');
  return 0;
}
