#include <bits/stdc++.h>
using namespace std;
const long long inf = 1000000007;
const int sz = 5000100;
const long double eps = 1e-9;
int n, m, a, b;
int k = -1;
char s[sz];
int link[sz];
string t;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> t >> m;
    for (int j = 0; j < m; ++j) {
      cin >> a;
      --a;
      k = max(a + int(t.size()) - 1, k);
      int endlink = max(a + int(t.size()) - 1, link[a + int(t.size()) - 1]);
      for (int z = a, x = 0; x < t.size();) {
        if (link[z] > z) {
          if (link[link[z]] != 0) {
            link[z] = link[link[z]];
          }
          int delta = link[z] - z;
          z += delta;
          x += delta;
          continue;
        }
        s[z] = t[x];
        link[z] = endlink;
        ++x;
        ++z;
      }
    }
  }
  for (int i = k; i >= 0; --i) {
    if (s[i] == 0) s[i] = 'a';
  }
  cout << s;
  return 0;
}
