#include <bits/stdc++.h>
using namespace std;
int n;
string ST[100010];
vector<pair<int, int> > pos[2000010];
char ans[2000010];
void solve() {
  scanf("%d", &n);
  int L = 0;
  for (int i = 1; i <= n; i++) {
    cin >> ST[i];
    int l = ((int)(ST[i]).size());
    int k;
    scanf("%d", &k);
    while (k--) {
      int x;
      scanf("%d", &x);
      pos[x].push_back(pair<int, int>(x, i));
      pos[x + l].push_back(pair<int, int>(x, -i));
      L = max(L, x + l - 1);
    }
  }
  multiset<pair<int, int> > S;
  for (int i = 1; i <= L; i++) {
    for (pair<int, int> e : pos[i]) {
      if (e.second > 0)
        S.insert(e);
      else
        S.erase(pair<int, int>(e.first, -e.second));
    }
    if (((int)(S).size()) == 0)
      ans[i] = 'a';
    else {
      pair<int, int> e = *S.begin();
      ans[i] = ST[e.second][i - e.first];
    }
  }
  printf("%s\n", ans + 1);
}
int main() {
  int Tc = 1;
  for (int tc = 1; tc <= Tc; tc++) {
    solve();
  }
  return 0;
};
