#include <bits/stdc++.h>
using namespace std;
int vis[2000007];
string s;
int main() {
  int n, k, i, j, l, x, len = 0, pos;
  string in;
  cin >> n;
  for (i = 0; i < 2000007; i++) s += 'a';
  for (i = 0; i < n; i++) {
    cin >> in >> k;
    pos = -(int)in.length();
    for (j = 1; j <= k; j++) {
      cin >> x;
      len = max(len, x + (int)in.length());
      for (l = max(0, pos + (int)in.length() - x); l < in.length(); l++)
        s[l + x] = in[l];
      pos = x;
    }
  }
  for (i = 1; i < len; i++) cout << s[i];
  cout << endl;
  return 0;
}
