#include <bits/stdc++.h>
using namespace std;
char a[2000005];
int n, mx, z, x, y;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  while (n--) {
    string t;
    cin >> t >> x;
    z = t.size();
    int p = -z;
    while (x--) {
      cin >> y;
      int j;
      for (j = max(0, p + z - y); j < z; j++) {
        a[j + y] = t[j];
        p = y;
      }
    }
  }
  int i;
  for (i = 2000004; !a[i];) i--;
  for (int j = 1; j <= i; j++) putchar(a[j] ? a[j] : 'a');
}
