#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e6 + 10;
int main() {
  int n;
  scanf("%d", &n);
  char a[maxn] = {};
  for (int i = 0; i < n; i++) {
    string s;
    int k;
    cin >> s >> k;
    int len = s.length();
    int pos1, pos2 = -len;
    for (int j = 0; j < k; j++) {
      scanf("%d", &pos1);
      for (int i = max(0, pos2 + len - pos1); i < len; i++) {
        a[i + pos1] = s[i];
      }
      pos2 = pos1;
    }
  }
  int i, j;
  for (j = maxn - 1; !a[j]; j--)
    ;
  for (int k = 1; k <= j; k++) {
    putchar(a[k] ? a[k] : 'a');
  }
  return 0;
}
