#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1e18;
const int inf = 1e9;
const int MOD = 1e9 + 7;
const int nax = 300000 + 10;
vector<pair<int, int> > v;
string s[nax];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
    int sz;
    cin >> sz;
    while (sz--) {
      int pos;
      cin >> pos;
      v.push_back({pos, i});
    }
  }
  sort(v.begin(), v.end());
  string ans = "";
  int pos = 1;
  for (auto x : v) {
    while (pos < x.first) ans += 'a', pos++;
    int start = pos - x.first;
    int len = s[x.second].length();
    while (start < len) ans += s[x.second][start], start++, pos++;
  }
  cout << ans;
  return 0;
}
