#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void amin(T &x, const T &y) {
  if (y < x) x = y;
}
template <class T>
inline void amax(T &x, const T &y) {
  if (x < y) x = y;
}
template <class Iter>
void rprintf(const char *fmt, Iter begin, Iter end) {
  for (bool sp = 0; begin != end; ++begin) {
    if (sp)
      putchar(' ');
    else
      sp = true;
    printf(fmt, *begin);
  }
  putchar('\n');
}
int N;
char buf[3000111];
char S[3000111];
vector<string> T;
vector<int> G[3000111];
void MAIN() {
  int stop = 0;
  scanf("%d", &N);
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    int K;
    scanf("%s%d", buf, &K);
    T.push_back(buf);
    int len = strlen(buf);
    for (int j = 0, j_len = (K); j < j_len; ++j) {
      int x;
      scanf("%d", &x);
      x--;
      G[x].push_back(i);
      amax(stop, x + len);
    }
  }
  vector<int> id, start;
  for (int i = 0, i_len = (stop); i < i_len; ++i) {
    for (__typeof((G[i]).begin()) e = (G[i]).begin(), e_end = (G[i]).end();
         e != e_end; ++e) {
      id.push_back(*e);
      start.push_back(i);
    }
    while (id.size() && start.back() + (int)T[id.back()].size() <= i) {
      id.pop_back();
      start.pop_back();
    }
    if (id.empty()) {
      S[i] = 'a';
    } else {
      S[i] = T[id.back()][i - start.back()];
    }
  }
  puts(S);
}
int main() {
  int TC = 1;
  for (int tc = 0, tc_len = (TC); tc < tc_len; ++tc) MAIN();
  return 0;
}
