#include <bits/stdc++.h>
using namespace std;
const int MAXBUF = 10000;
char buf[MAXBUF], *ps = buf, *pe = buf + 1;
inline bool isdigit(const char& n) { return (n >= '0' && n <= '9'); }
inline void rnext() {
  if (++ps == pe)
    pe = (ps = buf) +
         fread(buf, sizeof(char), sizeof(buf) / sizeof(char), stdin);
}
template <class T>
inline bool in(T& ans) {
  ans = 0;
  T f = 1;
  if (ps == pe) return false;
  do {
    rnext();
    if ('-' == *ps) f = -1;
  } while (!isdigit(*ps) && ps != pe);
  if (ps == pe) return false;
  do {
    ans = (ans << 1) + (ans << 3) + *ps - 48;
    rnext();
  } while (isdigit(*ps) && ps != pe);
  ans *= f;
  return true;
}
const int MAXOUT = 10000;
char bufout[MAXOUT], outtmp[50], *pout = bufout, *pend = bufout + MAXOUT;
inline void write() {
  fwrite(bufout, sizeof(char), pout - bufout, stdout);
  pout = bufout;
}
inline void out_char(char c) {
  *(pout++) = c;
  if (pout == pend) write();
}
inline void out_str(char* s) {
  while (*s) {
    *(pout++) = *(s++);
    if (pout == pend) write();
  }
}
template <class T>
inline void out_int(T x) {
  if (!x) {
    out_char('0');
    return;
  }
  if (x < 0) x = -x, out_char('-');
  int len = 0;
  while (x) {
    outtmp[len++] = x % 10 + 48;
    x /= 10;
  }
  outtmp[len] = 0;
  for (int i = 0, j = len - 1; i < j; i++, j--) swap(outtmp[i], outtmp[j]);
  out_str(outtmp);
}
template <typename T, typename... T2>
inline int in(T& value, T2&... value2) {
  in(value);
  return in(value2...);
}
const double eps = 1e-9;
const int maxn = 2e6 + 10;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
int N, M, tmp, K;
char str[maxn];
int tree[maxn];
int ans[maxn];
void init() {
  for (int i = 1; i <= 2e6 + 5; i++) tree[i] = i;
}
int find(int p) {
  int x = p;
  while (p != tree[p]) p = tree[p];
  while (x != p) {
    int t = tree[x];
    tree[x] = p;
    x = t;
  }
  return p;
}
void Union(int a, int b) {
  a = find(a);
  b = find(b);
  tree[a] = b;
}
int main() {
  scanf("%d", &N);
  init();
  int cnt = 0, n;
  int MAX = 0;
  for (int i = 1; i <= N; i++) {
    scanf("%s", str);
    int len = strlen(str);
    scanf("%d", &n);
    while (n--) {
      scanf("%d", &tmp);
      int e = tmp + len - 1;
      MAX = max(MAX, e);
      int x = find(tmp);
      while (x <= e) {
        ans[x] = str[x - tmp] - 'a';
        Union(x, x + 1);
        x = find(x + 1);
      }
    }
  }
  for (int i = 1; i <= MAX; i++) {
    putchar(ans[i] + 'a');
  }
  return 0;
}
