#include <bits/stdc++.h>
using namespace std;
static char ans[2000000];
int main() {
  int n;
  cin >> n;
  int len = 0;
  for (int i = 0; i < n; i++) {
    string t;
    int k;
    cin >> t >> k;
    int xx = -1;
    for (int j = 0; j < k; j++) {
      int x;
      scanf("%d", &x);
      x--;
      int start = 0;
      if (xx == -1) {
        start = 0;
      } else {
        if (xx + t.size() > x) {
          start = xx + t.size() - x;
        }
      }
      while (start < t.size()) {
        ans[start + x] = t[start];
        start++;
      }
      len = max(len, x + (int)t.size());
      xx = x;
    }
  }
  for (int i = 0; i < len; i++) {
    if (ans[i] == 0) {
      ans[i] = 'a';
    }
  }
  printf("%s\n", ans);
  return (0);
}
