#include <bits/stdc++.h>
using std::cerr;
using std::endl;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int MAXN = 1000005;
int n, tot;
std::string s[MAXN];
struct info {
  int id, pos;
  inline void init() { id = pos = 0; }
  inline friend bool operator<(info x, info y) { return x.pos < y.pos; }
} a[MAXN];
int main() {
  n = read();
  for (int i = (1); i <= (n); ++i) {
    std::cin >> s[i];
    int k = read();
    for (int j = (1); j <= (k); ++j) {
      int x = read();
      a[++tot] = (info){i, x};
    }
  }
  std::sort(a + 1, a + tot + 1);
  int ptr = 0, maxr = 0;
  info cur;
  cur.init();
  for (int i = (1); i <= (2e6); ++i) {
    while (ptr < tot && a[ptr + 1].pos <= i) {
      ++ptr;
      if (a[ptr].pos + s[a[ptr].id].length() - 1 > maxr) {
        maxr = a[ptr].pos + s[a[ptr].id].length() - 1;
        cur = a[ptr];
      }
    }
    if (maxr >= i)
      putchar(s[cur.id][i - cur.pos]);
    else
      putchar('a');
    if (ptr == tot && i - cur.pos + 1 == s[cur.id].length()) {
      putchar('\n');
      return 0;
    }
  }
  return 0;
}
