#include <bits/stdc++.h>
using namespace std;
const int N = 2000000 + 1067;
char a[N];
int par[N], con[N], last[N];
int findset(int x) {
  if (par[x] == 0)
    return x;
  else
    return findset(par[x]);
}
void dsu(int x, int y) {
  x = findset(x);
  y = findset(y);
  if (x == y) return;
  if (con[x] < con[y]) swap(x, y);
  par[y] = x;
  con[x] += con[y];
  last[x] = max(last[x], last[y]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  for (int i = 0; i <= 2000000; i++) {
    con[i] = 1;
    last[i] = i;
    a[i] = '-';
  }
  cin >> n;
  int res = 0;
  for (int i = 1; i <= n; i++) {
    string t;
    cin >> t;
    int m = t.length();
    int k;
    cin >> k;
    for (int j = 1; j <= k; j++) {
      int x;
      cin >> x;
      for (int i = x; i <= x + m - 1; i++) {
        if (a[i - 1] != '-') dsu(i, i - 1);
        a[i] = t[i - x];
        i = last[findset(i)];
      }
      res = max(res, x + m - 1);
    }
  }
  for (int i = 1; i <= res; i++)
    if (a[i] == '-')
      cout << 'a';
    else
      cout << a[i];
  cout << endl;
  return 0;
}
