#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-11;
int vex[4] = {1, 0, -1, 0};
int vey[4] = {0, 1, 0, -1};
long long int MOD = 1000000007;
const int MAX = 3000000;
string c[100005];
char s[MAX];
int main() {
  int n;
  cin >> n;
  using p = pair<int, pair<int, int>>;
  using po = pair<int, int>;
  vector<p> d;
  for (int i = 0; i < (MAX); i++) s[i] = '*';
  int last = 0;
  int a, b;
  for (int i = 0; i < (n); i++) {
    cin >> c[i];
    int t = c[i].size();
    cin >> a;
    for (int j = 0; j < (a); j++) {
      cin >> b;
      b--;
      d.push_back(p(b, po(b + t, i)));
    }
  }
  sort(d.begin(), d.end());
  int in = d.size();
  for (int j = 0; j < (in - 1); j++) {
    auto l = d[j];
    auto r = d[j + 1];
    if (l.first == r.first) continue;
    for (int k = max(l.first, last); k < l.second.first; k++) {
      s[k] = c[l.second.second][k - l.first];
    }
    last = max(l.second.first, last);
  }
  auto l = d[in - 1];
  for (int k = l.first; k < l.second.first; k++) {
    s[k] = c[l.second.second][k - l.first];
  }
  string ans = "";
  int la = 0;
  for (int i = (MAX)-1; i >= 0; i--) {
    if (s[i] != '*') {
      la = i;
      break;
    }
  }
  for (int i = 0; i < (la + 1); i++) {
    if (s[i] == '*')
      cout << 'a';
    else
      cout << s[i];
  }
  cout << endl;
}
