#include <bits/stdc++.h>
using namespace std;
inline int iseven(int x) { return x & 1 ? 0 : 1; }
inline bool is_double(double x) {
  double y = x - (int)x;
  return (y == x ? true : false);
}
long bigmod(long b, long p, long long m) {
  if (p == 0) return 1;
  if (p % 2 == 0) {
    return (long)pow(bigmod(b, p / 2, m) % m, 2) % m;
  }
  return (b % m * bigmod(b, p - 1, m) % m) % m;
}
template <class T>
ostream& operator<<(ostream& out, vector<T> v) {
  for (long long i = 0; i < v.size(); i++) out << v[i] << ' ';
  return out;
}
inline double distance(int x, int y, int a, int b) {
  return sqrt(pow(x - a, 2) + pow(y - b, 2));
}
vector<pair<int, int> > strings;
string a[1500100];
bool cmp(pair<int, int> x, pair<int, int> y) {
  if (x.first != y.first) return x.first < y.first;
  return a[x.second].length() < a[y.second].length();
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    int k;
    cin >> k;
    while (k--) {
      int x;
      cin >> x;
      strings.push_back(pair<int, int>(x, i));
    }
  }
  int p = 1;
  sort(strings.begin(), strings.end(), cmp);
  for (pair<int, int> x : strings) {
    int pos = x.first;
    if (pos > p) {
      for (; p < pos; p++) cout << 'a';
    }
    if (pos == p) {
      cout << a[x.second];
      p += a[x.second].length();
      continue;
    }
    if (pos < p) {
      if (pos + a[x.second].length() - 1 < p) continue;
      a[x.second].substr(p - pos);
      cout << a[x.second].substr(p - pos);
      p += a[x.second].substr(p - pos).length();
    }
  }
}
