#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:667177216")
using namespace std;
const long long MOD = 1000000000 + 7;
const int NN = 2 * 1000000 + 100;
int nxt[NN];
void build() {
  for (int(i) = 0; (i) < NN; (i)++) {
    nxt[i] = i;
  }
}
int get_next(int v) {
  if (nxt[v] == v) return v;
  return nxt[v] = get_next(nxt[v]);
}
int main() {
  ios::sync_with_stdio(false);
  char buff[NN];
  int n;
  scanf("%d\n", &n);
  build();
  vector<char> ans(NN);
  int maxi_r = -1;
  for (int(i) = 0; (i) < n; (i)++) {
    int k;
    scanf("%s %d", &buff, &k);
    int len = strlen(buff);
    for (int(j) = 0; (j) < k; (j)++) {
      int pos;
      scanf("%d", &pos);
      pos--;
      int l = get_next(pos), r = pos + len - 1;
      maxi_r = max(maxi_r, r);
      while (l <= r) {
        ans[l] = buff[l - pos];
        nxt[l] = l + 1;
        l = get_next(l);
      }
    }
    scanf("\n");
  }
  for (int i = 0; i <= maxi_r; ++i) {
    if (ans[i] == 0) ans[i] = 'a';
  }
  string tmp = string((ans).begin(), (ans).end());
  tmp = tmp.substr(0, maxi_r + 1);
  cout << tmp;
  return 0;
}
