#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const double EPS = 1e-9;
const int INF = 1 << 29;
int const NN = 1e6 + 6;
string s;
string t[NN];
pair<pair<int, int>, int> p[NN];
int tot = 0;
int mxI[NN];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    cin >> t[i];
    int len = t[i].length();
    int k;
    scanf("%d", &k);
    for (int j = 0; j < k; ++j) {
      int x;
      scanf("%d", &x);
      --x;
      int y = x + len - 1;
      p[tot++] = make_pair(make_pair(x, y), i);
    }
  }
  sort(p, p + tot);
  int mnIdx = NN, mxIdx = -1;
  int mx = -1;
  for (int i = 0; i < tot; ++i) {
    if (p[i].first.second > mx) {
      mxI[i] = i;
      mx = p[i].first.second;
    } else
      mxI[i] = mxI[i - 1];
    mnIdx = min(mnIdx, p[i].first.first);
    mxIdx = max(mxIdx, p[i].first.second);
  }
  for (int i = 0; i <= mxIdx; ++i) s += 'a';
  for (int i = 0; i < mnIdx; ++i) s[i] = 'a';
  for (int i = mnIdx; i <= mxIdx; ++i) {
    int lo = 0, hi = tot - 1, mid;
    while (lo <= hi) {
      mid = (lo + hi) >> 1;
      if (p[mid].first.first > i)
        hi = mid - 1;
      else
        lo = mid + 1;
    }
    if (p[mid].first.first > i) --mid;
    if (mid < 0) {
      s[i] = 'a';
      continue;
    }
    int idx = mxI[mid];
    int xx = p[idx].first.first;
    int yy = p[idx].first.second;
    int indexx = p[idx].second;
    if (i > yy || i < xx) {
      s[i] = 'a';
      continue;
    }
    s[i] = t[indexx][i - xx];
  }
  cout << s;
  putchar('\n');
  return 0;
}
