#include <bits/stdc++.h>
using namespace std;
string s1;
long long arr2[2000006];
long long dsu(long long x) { return arr2[x] == x ? x : arr2[x] = dsu(arr2[x]); }
int main() {
  char ans[2000006];
  long long n, t1, t2, t3, t4, t5;
  cin >> n;
  for (int i = 0; i < 2000006; i++) {
    ans[i] = 'a';
    arr2[i] = i;
  }
  t3 = 0;
  while (n--) {
    cin >> s1;
    t1 = s1.length();
    cin >> t2;
    while (t2--) {
      cin >> t4;
      t4--;
      if (t3 < t4 + t1 - 1) t3 = t4 + t1 - 1;
      for (int i = dsu(t4); i < t4 + t1;) {
        ans[i] = s1[i - t4];
        arr2[i] = i + 1;
        i = dsu(i);
      }
    }
  }
  t5 = 0;
  while (1) {
    cout << ans[t5++];
    if (t5 > t3) break;
  }
  return 0;
}
