#include <bits/stdc++.h>
using namespace std;
long long int tc, sz = 0;
char ans[2000005];
int main() {
  scanf("%lld", &tc);
  memset(ans, 0, sizeof(ans));
  while (tc--) {
    string t;
    cin >> t;
    long long int len = t.size();
    long long int n, prev = 0;
    scanf("%lld", &n);
    while (n--) {
      long long int x;
      scanf("%lld", &x);
      x--;
      sz = max(sz, x + len);
      for (long long int i = max(x, prev); i < x + len; i++) {
        ans[i] = t[i - x];
      }
      prev = len + x;
    }
  }
  for (long long int i = 0; i < sz; i++) {
    if (ans[i] == 0) ans[i] = 'a';
  }
  cout << ans;
  printf("\n");
}
