#include <bits/stdc++.h>
using namespace std;
int abcxxddaldkjfpoe[2000005];
char ans[2000005];
char pat[2000005];
int T;
int n = 0;
int main() {
  ios::sync_with_stdio(false);
  for (int i = 0; i < 2000005; ++i) abcxxddaldkjfpoe[i] = i + 1;
  scanf("%d", &T);
  while (T--) {
    scanf("%s", pat);
    int len = strlen(pat);
    int m;
    scanf("%d", &m);
    while (m--) {
      int t;
      scanf("%d", &t);
      int ed = t + len - 1;
      int pre = t - 1, p = t;
      n = max(n, t + len - 1);
      while (p < t + len) {
        ans[p] = pat[p - t];
        pre = p;
        p = abcxxddaldkjfpoe[p];
        abcxxddaldkjfpoe[pre] = abcxxddaldkjfpoe[ed];
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    if (ans[i])
      cout << ans[i];
    else
      cout << 'a';
  }
  cout << endl;
  return 0;
}
