#include <bits/stdc++.h>
using namespace std;
const int N = 3000005;
char s[N];
string tmp;
int main() {
  int t, x, n, ma = 0;
  for (int i = 0; i < N; i++) s[i] = 'a';
  scanf("%d", &t);
  while (t--) {
    int p = -1 << 30;
    cin >> tmp;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
      scanf("%d", &x);
      if (x - p >= tmp.length()) {
        for (int k = 0; k < tmp.length(); k++) s[x + k] = tmp[k];
      } else {
        int c = 0;
        for (int k = x - p; k > 0; k--) {
          s[p + tmp.length() + c] = tmp[tmp.length() - k];
          c++;
        }
      }
      p = x;
      ma = max(ma, x + (int)tmp.length());
    }
  }
  s[ma] = '\0';
  printf("%s", s + 1);
  return 0;
}
