#include <bits/stdc++.h>
using namespace std;
const long long UNDEF = -1;
const long long INF = 1e18;
template <typename T>
inline bool chkmax(T& aa, T bb) {
  return aa < bb ? aa = bb, true : false;
}
template <typename T>
inline bool chkmin(T& aa, T bb) {
  return aa > bb ? aa = bb, true : false;
}
static char stdinBuffer[1024];
static char* stdinDataEnd = stdinBuffer + sizeof(stdinBuffer);
static const char* stdinPos = stdinDataEnd;
void readAhead(size_t amount) {
  size_t remaining = stdinDataEnd - stdinPos;
  if (remaining < amount) {
    memmove(stdinBuffer, stdinPos, remaining);
    size_t sz = fread(stdinBuffer + remaining, 1,
                      sizeof(stdinBuffer) - remaining, stdin);
    stdinPos = stdinBuffer;
    stdinDataEnd = stdinBuffer + remaining + sz;
    if (stdinDataEnd != stdinBuffer + sizeof(stdinBuffer)) *stdinDataEnd = 0;
  }
}
int readInt() {
  readAhead(16);
  int x = 0;
  bool neg = false;
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  if (*stdinPos == '-') {
    ++stdinPos;
    neg = true;
  }
  while (*stdinPos >= '0' && *stdinPos <= '9') {
    x *= 10;
    x += *stdinPos - '0';
    ++stdinPos;
  }
  return neg ? -x : x;
}
char readCh() {
  readAhead(16);
  while (*stdinPos == ' ' || *stdinPos == '\n') ++stdinPos;
  char ans = *stdinPos;
  ++stdinPos;
  return ans;
}
const int mn = 2e6 + 4;
string t[mn];
char tmp[mn];
pair<int, int> tab[mn];
char vfinal[mn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int flen = 0;
  for (int i = 0; i < n; i++) {
    int k;
    cin >> t[i] >> k;
    int slen = t[i].length();
    for (int j = 0; j < k; j++) {
      int x;
      cin >> x;
      --x;
      chkmax(tab[x], make_pair(slen, i));
      chkmax(flen, slen + x);
    }
  }
  int last = -1;
  for (int x = 0; x < flen; x++) {
    if (tab[x].first > 0 &&
        (last == -1 || tab[x].first + x > tab[last].first + last)) {
      last = x;
    }
    if (last == -1)
      vfinal[x] = 'a';
    else {
      pair<int, int> got = tab[last];
      int idx = x - last;
      int slen = got.first;
      if (idx >= slen)
        vfinal[x] = 'a';
      else
        vfinal[x] = t[got.second][idx];
    }
  }
  printf("%s\n", vfinal);
}
