#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int INF = 1e9 + 10;
const long double EPS = 1e-8;
const int M = 1e2 + 12;
const int MAX = 1e3 + 1;
const int N = 2e6 + 1;
string s[N];
int cnt[N];
vector<int> nums[N];
char s2[N];
struct seg {
  int l, r, num;
};
bool cmp(seg a, seg b) { return a.l < b.l; }
int main() {
  int n;
  scanf("%d", &n);
  int mx = 0;
  vector<seg> v;
  for (int i = 0; i < n; ++i) {
    scanf("%s", s2);
    s[i] = s2;
    scanf("%d", &cnt[i]);
    for (int j = 0; j < cnt[i]; ++j) {
      int x;
      scanf("%d", &x);
      x--;
      nums[i].push_back(x);
      v.push_back({x, x + (int)s[i].size() - 1, i});
      mx = max(mx, (int)s[i].size() + x);
    }
  }
  sort(v.begin(), v.end(), cmp);
  string ans;
  for (int i = 0; i < mx; ++i) ans += 'a';
  int r = 0;
  for (int i = 0; i < v.size(); ++i) {
    for (int j = max(r, v[i].l); j < v[i].r + 1; ++j)
      ans[j] = s[v[i].num][j - v[i].l];
    r = max(r, v[i].r + 1);
  }
  cout << ans << endl;
}
