#include <bits/stdc++.h>
using namespace std;
map<int, bool> viss;
int vis[1000000 + 4];
vector<string> strings;
int main() {
  ios::sync_with_stdio(false);
  int n, k, val;
  string str;
  strings.push_back("");
  cin >> n;
  int max_ = -1;
  for (int i = 0; i < n; i++) {
    cin >> str >> k;
    strings.push_back(str);
    for (int j = 0; j < k; j++) {
      cin >> val;
      max_ = max(max_, val + (int)str.length() - 1);
      viss[val] = true;
      if (strings[vis[val]].length() < str.length()) {
        vis[val] = i + 1;
      }
    }
  }
  int cur = -1, last = 0;
  for (int i = 1; i <= max_; i++) {
    if ((viss[i]) && (i + strings[vis[i]].length() - 1) > last) {
      cur = i;
      last = i + strings[vis[i]].size() - 1;
    }
    if (i <= last) {
      cout << strings[vis[cur]][i - cur];
    } else {
      cout << "a";
    }
  }
  return 0;
}
