#include <bits/stdc++.h>
using namespace std;
char ans[2000005];
vector<int> lis[2000005];
string Str[2000005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int m = 0;
  for (int i = 0; i < n; i++) {
    string str;
    cin >> str;
    Str[i] = str;
    int k;
    cin >> k;
    while (k--) {
      int a;
      cin >> a;
      lis[a].push_back(i);
      m = max(m, int(a + str.length() - 1));
    }
  }
  int r = -1, p = 0, ind = 0;
  for (int i = 1; i <= m; i++) {
    for (int j = 0; j < lis[i].size(); j++) {
      int a = Str[lis[i][j]].size();
      int b = r - p;
      if (a > b) {
        r = Str[lis[i][j]].length();
        p = 0;
        ind = lis[i][j];
      }
    }
    if (p < r) {
      ans[i] = Str[ind][p];
      p++;
    } else {
      ans[i] = 'a';
    }
    cout << ans[i];
  }
  return 0;
}
