#include <bits/stdc++.h>
using namespace std;
int n, t, x, mx;
char a[2000005];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    string s;
    cin >> s >> t;
    int len = s.size();
    int poz = -len;
    for (int j = 1; j <= t; j++) {
      cin >> x;
      for (int l = max(0, poz + len - x); l < len; l++) a[x + l] = s[l];
      poz = x;
      mx = max(mx, x + len);
    }
  }
  for (int i = mx - 1; i > 0; i--)
    if (!a[i]) a[i] = 'a';
  cout << a + 1;
  return 0;
}
