#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  return (b < a) ? (a = b, 1) : 0;
}
using ll = long long;
using R = long double;
const R EPS = 1e-9L;
inline int sgn(const R &r) { return (r > EPS) - (r < -EPS); }
inline R sq(R x) { return sqrt(max(x, 0.0L)); }
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
using pii = pair<int, int>;
multiset<pii> s;
string t[100010];
const int limit = 2000010;
vector<pii> in[limit];
vector<pii> out[limit];
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int cmax = 0;
  for (int i = int(0); i < int(n); ++i) {
    cin >> t[i];
    int k;
    cin >> k;
    for (int loop = int(0); loop < int(k); ++loop) {
      int l;
      cin >> l, l--;
      const int r = l + t[i].size();
      chmax(cmax, r);
      in[l].push_back(pii(i, l));
      out[r].push_back(pii(i, l));
    }
  }
  string ans = string(cmax, 'a');
  for (int i = int(0); i < int(cmax); ++i) {
    for (auto &elem : out[i]) s.erase(elem);
    for (auto &elem : in[i]) s.insert(elem);
    auto it = begin(s);
    if (it != end(s)) ans[i] = t[it->first][i - it->second];
  }
  cout << ans << endl;
  return 0;
}
