#include <bits/stdc++.h>
using namespace std;
class Node {
 public:
  int id;
  int start;
  int end;
  Node() : id(-1), start(-1), end(-1) {}
  Node(int _id, int _start, int _len)
      : id(_id), start(_start), end(_start + _len - 1) {}
};
bool cmp(Node a, Node b) {
  return a.start < b.start || (a.start == b.start && a.end > b.end);
}
int main() {
  vector<Node> vec(1000010);
  vector<string> str;
  int n = 0;
  cin >> n;
  int id = 0;
  int k_cnt = 0;
  for (int i = 0; i < n; i++) {
    string s;
    int k = 0;
    cin >> s >> k;
    int len = s.length();
    str.push_back(s);
    for (int j = 0; j < k; j++) {
      int pos = 0;
      scanf("%d", &pos);
      vec[k_cnt].id = i;
      vec[k_cnt].start = pos;
      vec[k_cnt].end = pos + len - 1;
      k_cnt += 1;
    }
  }
  sort(vec.begin(), vec.begin() + k_cnt, cmp);
  int curr = 1;
  for (int i = 0; i < k_cnt; i++) {
    while (vec[i].start > curr) {
      putchar('a');
      curr += 1;
    }
    if (vec[i].end < curr) {
      continue;
    }
    cout << str[vec[i].id].substr(curr - vec[i].start);
    curr = vec[i].end + 1;
  }
  cout << endl;
  return 0;
}
