#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  const int N = 2e6 + 10;
  vector<pair<int, int> > best(N, pair<int, int>(0, 0));
  int n;
  cin >> n;
  vector<string> s(n);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    int m;
    cin >> m;
    for (int j = 0; j < m; j++) {
      int x;
      cin >> x;
      best[x - 1] = max(best[x - 1], pair<int, int>(int(s[i].size()), i));
    }
  }
  string ans(N, ' ');
  for (int i = 0; i + 1 < N; i++) {
    if (best[i].first == 0) continue;
    auto [len, j] = best[i];
    ans[i] = s[j][int(s[j].size()) - len];
    len -= 1;
    if (len == 0) continue;
    best[i + 1] = max(best[i + 1], pair<int, int>(len, j));
  }
  while (ans.back() == ' ') ans.pop_back();
  for (char& ch : ans)
    if (ch == ' ') ch = 'a';
  cout << ans << '\n';
  return (0);
}
