#include <bits/stdc++.h>
using namespace std;
char c[2000007];
set<int> s;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < 2000007; i++) {
    s.insert(i);
  }
  set<int>::iterator it;
  int maxy = 0;
  for (int i = 0; i < n; i++) {
    string l;
    cin >> l;
    int k;
    scanf("%d", &k);
    while (k--) {
      int x;
      scanf("%d", &x);
      while (1) {
        it = s.lower_bound(x);
        if (it != s.end() && (*it) <= l.length() + x - 1) {
          c[*it] = l[(*it) - x];
          maxy = max(maxy, *it);
          s.erase(it);
        } else
          break;
      }
    }
  }
  c[maxy + 1] = '\0';
  for (int i = 1; i <= maxy; i++) {
    if (s.find(i) != s.end()) c[i] = 'a';
  }
  printf("%s\n", c + 1);
}
