#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000005;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const double eps = 1e-6;
struct node {
  int pos, id;
} a[maxn];
bool cmp(const node &a, const node &b) { return a.pos < b.pos; }
string s[maxn];
int main() {
  int n, k, x;
  int cnt = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    scanf("%d", &k);
    for (int j = 0; j < k; j++) {
      scanf("%d", &x);
      a[cnt].pos = x;
      a[cnt++].id = i;
    }
  }
  sort(a, a + cnt, cmp);
  string ans;
  int now = 1;
  for (int i = 0; i < cnt; i++) {
    while (now < a[i].pos) {
      ans += 'a';
      now++;
    }
    for (int j = now - a[i].pos; j < s[a[i].id].length(); j++) {
      ans += s[a[i].id][j];
      now++;
    }
  }
  cout << ans << endl;
}
