#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
using ll = long long;
using ld = long double;
constexpr int nax = 2 * 1000 * 1000 + 105;
constexpr int infty = 1000 * 1000 * 1000 + 5;
constexpr int mod = 1000 * 1000 * 1000 + 7;
int m;
char tab[nax];
char buf[nax];
int jest[nax];
string str[nax];
vector<int> pos[nax];
int main() {
  int n;
  scanf("%d", &n);
  vector<int> v;
  for (int j = 0; j < n; j++) {
    scanf("%s", buf);
    str[j] = buf;
    v.push_back(j);
    int k;
    scanf("%d", &k);
    while (k--) {
      int x;
      scanf("%d", &x);
      pos[j].push_back(x);
      jest[x] = max(jest[x], (int)str[j].size());
    }
  }
  sort(v.begin(), v.end(),
       [](int a, int b) -> bool { return str[a].size() > str[b].size(); });
  debug() << " ["
          << "v"
             ": "
          << (v) << "] ";
  for (int j : v) {
    string& s = str[j];
    for (int x : pos[j]) {
      for (int i = 0; i < (int)s.size(); i++) {
        if (jest[x + i] > (int)s.size() - i) break;
        if (tab[x + i]) break;
        tab[x + i] = s[i];
        m = max(m, x + i);
      }
    }
  }
  for (int i = 1; i <= m; i++) {
    if (tab[i] == '\0') tab[i] = 'a';
    printf("%c", tab[i]);
  }
  printf("\n");
  return 0;
}
