#include <bits/stdc++.h>
const int MAX = 1e5 + 1;
using namespace std;
void sc(int &x) {
  register int c = getchar();
  x = 0;
  int neg = 0;
  for (; ((c < 48 || c > 57) && c != '-'); c = getchar())
    ;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (neg) x = -x;
}
long long power(long long a, long long b, long long mod) {
  long long res = 1;
  while (b > 0) {
    if (b % 2 != 0) res = (res * a) % mod;
    a = (a * a) % mod;
    b /= 2;
  }
  return res;
}
long long gcd(long long a, long long b) {
  return ((b == 0) ? a : gcd(b, a % b));
}
int l[4000002];
string s[4000002];
char ans[4000002];
int main() {
  int i, j, n, m, r, idx, maxidx = -1e9, k;
  sc(n);
  for (i = 0; i < 4000001; i++) ans[i] = 'a';
  for (i = 1; i < n + 1; i++) {
    cin >> s[i];
    m = s[i].length();
    cin >> k;
    for (j = 0; j < k; j++) {
      sc(idx);
      maxidx = max(maxidx, idx + m - 1);
      if (!l[idx] || idx + s[l[idx]].length() < idx + s[i].length()) l[idx] = i;
    }
  }
  for (i = 1; i <= maxidx;) {
    if (l[i]) {
      for (j = i; j - i < s[l[i]].length() &&
                  (!l[j] || j + s[l[j]].length() <= i + s[l[i]].length());
           ++j)
        ans[j] = s[l[i]][j - i];
      i = j;
    } else
      ++i;
  }
  for (i = 1; i < maxidx + 1; i++) cout << ans[i];
  return 0;
}
