#include <bits/stdc++.h>
using namespace std;
const int maxn = 3000010;
int n, k, poi;
char t[maxn];
char s[maxn];
int main() {
  scanf("%d", &n);
  int maxlen = 0;
  for (int i = 0; i < n; i++) {
    scanf("%s%d", &t, &k);
    int pre = -1;
    int len = strlen(t);
    for (int j = 0; j < k; j++) {
      scanf("%d", &poi);
      poi--;
      int sta = max(pre, poi);
      maxlen = max(maxlen, poi + len);
      for (int i = sta; i < poi + len; i++) {
        s[i] = t[i - poi];
      }
      pre = poi + len;
    }
  }
  for (int i = 0; i < maxlen; i++) {
    if (s[i] == 0) s[i] = 'a';
  }
  cout << s << endl;
}
