#include <bits/stdc++.h>
using namespace std;
struct node {
  int pos;
  int index;
  int length;
};
string input[1000100];
string in;
pair<int, int> arr[3000100];
vector<node> ans;
int n, k, x, len;
int main(void) {
  cin >> n;
  int max_index = 0, next_index = 1, current = 1;
  node semi;
  for (int i = 0; i < n; i++) {
    cin >> in;
    input[i] = in;
    cin >> k;
    len = in.size();
    for (int j = 0; j < k; j++) {
      cin >> x;
      if (arr[x].second < len) {
        arr[x].first = i;
        arr[x].second = len;
      }
      max_index = max(max_index, x);
    }
  }
  for (int i = 1; i <= max_index; i++) {
    if (arr[i].second == 0) continue;
    semi.pos = i, semi.index = arr[i].first, semi.length = arr[i].second;
    ans.push_back(semi);
  }
  for (int i = 0; i < ans.size(); i++) {
    if (current == ans[i].pos) {
      cout << input[ans[i].index];
      current += ans[i].length;
    } else if (current < ans[i].pos) {
      for (int j = current; j < ans[i].pos; j++) cout << 'a';
      cout << input[ans[i].index];
      current = ans[i].pos + ans[i].length;
    } else {
      if (current >= ans[i].pos + ans[i].length) continue;
      cout << input[ans[i].index].substr(
          current - ans[i].pos, ans[i].length - (current - ans[i].pos));
      current = ans[i].pos + ans[i].length;
    }
  }
  return 0;
}
