#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(T a, T b = 0) {
  if (b == 0) return (a < 0) ? -a : a;
  return (a > b) ? (a - b) : (b - a);
}
template <class T>
inline T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
long long xp(long long b, long long n, long long m) {
  long long r = 1;
  while (n > 0) {
    if (n & 1) {
      r = r * b;
      if (r >= m) r %= m;
    }
    n >>= 1;
    b = b * b;
    if (b >= m) b %= m;
  }
  return r % m;
}
long long inv(long long a, long long m) {
  long long m0 = m, t, q;
  long long x0 = 0, x1 = 1;
  if (m == 1) return 0;
  while (a > 1) {
    q = a / m;
    t = m;
    m = a % m, a = t;
    t = x0;
    x0 = x1 - q * x0;
    x1 = t;
  }
  if (x1 < 0) x1 += m0;
  return x1;
}
bool pali(string temp, int i, int j) {
  if (i >= j) return true;
  if (temp[i] == temp[j]) return pali(temp, i + 1, j - 1);
  return false;
}
template <typename F, typename S>
ostream &operator<<(ostream &os, const pair<F, S> &p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  typename vector<T>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++) {
    if (it != v.begin()) os << ",";
    os << *it;
  }
  return os << "}";
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &v) {
  os << "[";
  typename set<T>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++) {
    if (it != v.begin()) os << ",";
    os << *it;
  }
  return os << "]";
}
template <typename F, typename S>
ostream &operator<<(ostream &os, const map<F, S> &v) {
  os << "[";
  typename map<F, S>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++) {
    if (it != v.begin()) os << ",";
    os << it->first << "=" << it->second;
  }
  return os << "]";
}
vector<int> num[3000002];
string str[3000002];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int lim = 0;
  for (int i = 1; i < n + 1; i++) {
    cin >> str[i];
    int k;
    cin >> k;
    while (k--) {
      int temp;
      cin >> temp;
      lim = max(lim, temp + (int)str[i].size() - 1);
      num[temp].push_back(i);
    }
  }
  string ans;
  ans.resize(lim + 1);
  priority_queue<pair<int, int>, vector<pair<int, int> >,
                 greater<pair<int, int> > >
      pq;
  for (int i = 1; i < lim + 1; i++) {
    while (num[i].size()) {
      pq.push(make_pair(i + str[num[i].back()].size() - 1, num[i].back()));
      num[i].pop_back();
    }
    if (pq.empty()) {
      ans[i] = 'a';
      continue;
    }
    pair<int, int> front = pq.top();
    int sesh = front.first, no = front.second;
    ans[i] = str[no][str[no].size() - sesh + i - 1];
    while (pq.size() and pq.top().first == i) pq.pop();
  }
  cout << ans.substr(1, lim) << endl;
  return 0;
}
