#include <bits/stdc++.h>
using namespace std;
int nxt[2000009], n, pre[2000009];
char ans[2000009], s[2000009];
set<int> st;
int main() {
  cin >> n;
  for (int i = 0; i < 2000009; i++) st.insert(i);
  for (int i = 1; i <= n; i++) {
    scanf("%s", s);
    int len = strlen(s);
    int num;
    scanf("%d", &num);
    for (int j = 0; j < num; j++) {
      int x;
      scanf("%d", &x);
      x--;
      auto it = st.lower_bound(x);
      while ((*it) <= x + len - 1) {
        ans[*it] = s[(*it) - x];
        auto itt = it;
        ++itt;
        st.erase(it);
        it = itt;
      }
    }
  }
  bool ok = 0;
  for (int i = 2000009 - 1; i >= 0; i--) {
    if (ans[i] != 0) {
      ok = 1;
    }
    if (ok && ans[i] == 0) {
      ans[i] = 'a';
    }
  }
  puts(ans);
  return 0;
}
