#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const int inf = (int)1e8 + 100;
const long long MAXN = 300005;
const long long MAXVAL = 10000000;
const long long INF = (long long)1e17 + 50;
const long long MOD = (long long)1e9 + 7;
const unsigned long long HASH_MOD = 2305843009213693951;
string failMessage;
void fail() {
  cout << failMessage;
  exit(0);
};
const int max_len = 2e6 + 5;
char s[max_len], temp[max_len];
int ind[max_len];
void solve() {
  fill(ind, ind + max_len, -1);
  int n;
  scanf("%d", &n);
  string t;
  int k;
  int m = -1;
  vector<string> a(n);
  for (int i = 0; i < n; i++) {
    scanf("%s", &temp);
    scanf("%d", &k);
    t = temp;
    a[i] = t;
    int start, end, x, len = t.length();
    for (int j = 0; j < k; j++) {
      scanf("%d", &x);
      x--;
      start = x;
      end = x + len - 1;
      if (end > m) {
        for (int l = m + 1; l <= end; l++) {
          s[l] = 'a';
        }
        m = end;
      }
      if (ind[x] == -1 || len > a[ind[x]].length()) ind[x] = i;
    }
  }
  int cur_end = -1;
  for (int i = 0; i < max_len; i++) {
    if (ind[i] == -1) continue;
    int start = i, end = i + a[ind[i]].length() - 1;
    for (int j = max(start, cur_end + 1); j <= end; j++)
      s[j] = a[ind[i]][j - start];
    cur_end = max(cur_end, end);
  }
  for (int i = 0; i <= m; i++) printf("%c", s[i]);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.precision(15);
  solve();
  (void)0;
}
