#include <bits/stdc++.h>
using namespace std;
int n, k, xmax, x;
string s[100009];
int str[1000009];
string ans;
char a[2 * 1000009];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  s[0] = "a";
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
    cin >> k;
    for (int j = 1; j <= k; j++) {
      cin >> x;
      xmax = max(xmax, x);
      if (s[str[x]].size() <= s[i].size()) str[x] = i;
    }
  }
  int last = 1;
  for (int i = 1; i <= xmax; i++) {
    for (; last < i + s[str[i]].size(); last++) {
      a[last] = s[str[i]][last - i];
    }
  }
  cout << a + 1 << '\n';
}
