#include <bits/stdc++.h>
using namespace std;
const int N = 2.1e6;
int n, x, len, cur, en, ind, st, k[N], l[N];
string t[N];
char ans[N];
vector<int> ev[N];
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> t[i];
    l[i] = t[i].size();
    scanf("%d", &k[i]);
    for (int j = 0; j < k[i]; ++j) {
      scanf("%d", &x);
      ev[x].push_back(i);
      len = max(len, x + l[i] - 1);
    }
  }
  ind = en = st = -1;
  for (int i = 1; i < len + 1; ++i) {
    if (en < i) ind = -1;
    for (int j : ev[i]) {
      cur = i + l[j] - 1;
      if (cur > en) st = i, en = cur, ind = j;
    }
    if (ind == -1)
      ans[i] = 'a';
    else
      ans[i] = t[ind][i - st];
  }
  for (int i = 1; i < len + 1; ++i) printf("%c", ans[i]);
  return 0;
}
