#include <bits/stdc++.h>
using namespace std;
const int maxN = 2000000 + 5;
const int maxM = 100000 + 5;
template <typename TT>
inline void read(TT &x) {
  TT f = 1;
  x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
int n;
char ans[maxN];
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  int maxP = 0;
  for (int i = 0; i < n; i++) {
    string t;
    int k, pre = -1;
    cin >> t >> k;
    for (int i = 0; i < k; i++) {
      int p;
      cin >> p;
      p--;
      maxP = max(maxP, p + (int)t.length());
      for (int i = max(p, pre); i < p + (int)t.length(); i++) ans[i] = t[i - p];
      pre = p + (int)t.length();
    }
  }
  for (int i = 0; i < maxP; i++) cout << (ans[i] != 0 ? ans[i] : 'a');
  return 0;
}
