#include <bits/stdc++.h>
using namespace std;
const int MX = (1 << 21);
int mx[MX], who[MX];
int Q, lim;
char ccc[MX];
string str[MX];
int main() {
  scanf("%d", &Q);
  for (int j = 1; j <= Q; j++) {
    scanf("%s", ccc);
    str[j] = ccc;
    int kk;
    scanf("%d", &kk);
    while (kk--) {
      int x;
      scanf("%d", &x);
      if (mx[x] < str[j].size()) {
        mx[x] = str[j].size();
        who[x] = j;
      }
      lim = max(lim, x - 1 + (int)(str[j].size()));
    }
  }
  string sol;
  int cur = 0, which = 0, pos = 0;
  for (int j = 1; j <= lim; j++) {
    if (cur < mx[j]) {
      cur = mx[j];
      which = who[j];
      pos = 0;
    }
    if (cur == 0) {
      sol += "a";
      continue;
    }
    sol.push_back(str[which][pos]);
    ++pos;
    cur--;
  }
  cout << sol << endl;
}
