#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f3f3f3f3f3f3f;
const double pi = acos(-1.0);
const double eps = 1e-9;
char str[2000010];
char ans[2000010];
int main() {
  memset(ans, '#', sizeof(ans));
  int n, maxx = -1;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%s", str);
    int len = strlen(str);
    int m;
    scanf("%d", &m);
    int poss = -len;
    while (m--) {
      int pos;
      scanf("%d", &pos);
      pos--;
      maxx = max(maxx, pos + len);
      for (int j = max(0, len + poss - pos); j < len; j++) {
        ans[j + pos] = str[j];
      }
      poss = pos;
    }
  }
  for (int i = 0; i < maxx; i++) {
    if (ans[i] == '#') ans[i] = 'a';
  }
  ans[maxx] = '\0';
  printf("%s\n", ans);
  return 0;
}
