#include <bits/stdc++.h>
using namespace std;
long long t, n, m, u, v, q, k;
const int N = 3e6 + 500;
const int LN = 21;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 57;
long long arr[N];
string str, ss;
vector<int> pos[N];
string s[N];
int pointer[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  int mx = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> s[i];
    cin >> k;
    for (int j = 0; j < k; ++j) {
      int place;
      cin >> place;
      place--;
      mx = max(mx, (int)place + (int)s[i].size());
      pos[place].push_back(i);
    }
  }
  str.resize(mx, 'a');
  int cur = -1;
  for (int i = 0; i < mx; ++i) {
    for (int j = 0; j < pos[i].size(); ++j) {
      if (cur == -1 || s[cur].size() - pointer[cur] < s[pos[i][j]].size()) {
        if (cur != -1) pointer[cur] = 0;
        cur = pos[i][j];
      }
    }
    if (cur == -1 || pointer[cur] == s[cur].size()) {
      str[i] = 'a';
      continue;
    }
    str[i] = s[cur][pointer[cur]++];
  }
  cout << str << endl;
  return 0;
}
