#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
int n, pos[maxn];
string s[maxn];
int main() {
  ios::sync_with_stdio(false);
  for (int i = 1; i < maxn; i++) pos[i] = -1;
  int m = -1;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> s[i] >> t;
    int len = s[i].length();
    for (int j = 0; j < t; j++) {
      int x;
      cin >> x;
      if (pos[x] == -1 || s[pos[x]].length() < len) pos[x] = i;
      m = max(m, x + len - 1);
    }
  }
  int ind = -1, cur = -1;
  for (int i = 1; i <= m; i++) {
    if (i < maxn && pos[i] != -1) {
      if (cur == -1 || s[pos[i]].length() > s[cur].length() - ind) {
        cur = pos[i];
        ind = 0;
      }
    }
    if (ind != -1)
      cout << s[cur][ind++];
    else
      cout << "a";
    if (ind == s[cur].length()) {
      cur = -1;
      ind = -1;
    }
  }
  return 0;
}
