#include <bits/stdc++.h>
using namespace std;
const int MXN = 2e6 + 30;
const int MAXN = 2e2 + 1;
const long long INF = 1e9 + 7;
const long long BINF = 1e15;
const int MOD = 1e9 + 7;
const long double EPS = 1e-15;
const long long dx[] = {0, 0, 1, -1};
const long long dy[] = {1, -1, 0, 0};
const char cc[] = {'R', 'L', 'D', 'U'};
int n;
string a[MXN];
int m[MXN];
int q;
vector<int> x[MXN];
int ind;
char ans[MXN];
int to[MXN * 4];
void push(int v) {
  if (to[v] != -1) {
    to[v * 2] = to[v * 2 + 1] = to[v], to[v] = -1;
  }
}
void upd(int v, int tl, int tr, int l, int r, int x) {
  if (l > r) return;
  if (l == tl && r == tr) {
    to[v] = x;
  } else {
    int tm = (tl + tr) / 2;
    push(v);
    upd(v * 2, tl, tm, l, min(r, tm), x);
    upd(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r, x);
  }
}
int Find(int v, int tl, int tr, int x) {
  if (tl == tr) {
    return to[v];
  }
  int tm = (tl + tr) / 2;
  push(v);
  if (x <= tm) {
    return Find(v * 2, tl, tm, x);
  } else {
    return Find(v * 2 + 1, tm + 1, tr, x);
  }
}
char F(int i, int q) {
  int l = 1, r = m[i];
  while (r - l > 1) {
    int mid = (r + l) / 2;
    if (x[i][mid] > q) {
      r = mid;
    } else {
      l = mid;
    }
  }
  if (x[i][r] <= q) {
    return a[i][q - x[i][r]];
  } else {
    return a[i][q - x[i][l]];
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie();
  srand(time(NULL));
  cin >> n;
  for (int i = 1; i <= 2e6; i++) {
    ans[i] = '1';
  }
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    cin >> m[i];
    x[i].push_back(1);
    for (int j = 1; j <= m[i]; j++) {
      cin >> q;
      x[i].push_back(q);
      upd(1, 1, 2e6, x[i][j], x[i][j] + a[i].size() - 1, i);
    }
  }
  for (int i = 1; i <= 2e6; i++) {
    int x = Find(1, 1, 2e6, i);
    if (x != 0) {
      ind = i;
      ans[i] = F(x, i);
    } else {
      ans[i] = 'a';
    }
  }
  for (int i = 1; i <= ind; i++) {
    cout << ans[i];
  }
  return 0;
}
