#include <bits/stdc++.h>
const int N = 2e6 + 10;
const long long int inf = 12345689012345678;
const long double pi = 3.141592653589793;
const int md = 1e7 + 7;
using namespace std;
int here = 1;
void getStop() {
  here++;
  if (here >= N) {
    cout << "\n\n\t Infinite loop \n\n";
    exit(1);
  }
  return;
}
void io(bool ok) {
  freopen("input.txt", "r", stdin);
  if (ok) freopen("output.txt", "w", stdout);
}
set<int> indxSet;
char resultArray[N], s[N];
int resultLen = 0;
int main() {
  for (int i = 1; i <= N; i++) {
    indxSet.insert(i);
  }
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    int k, l = strlen(s);
    scanf("%d", &k);
    for (int i = 0; i < k; i++) {
      int x;
      scanf("%d", &x);
      resultLen = max(resultLen, l + x - 1);
      while (true) {
        auto it = indxSet.lower_bound(x);
        if ((*it - x >= l) or it == indxSet.end()) {
          break;
        }
        resultArray[*it] = s[*it - x];
        indxSet.erase(it);
        it = indxSet.lower_bound(x);
      }
    }
  }
  for (int i = 1; i <= resultLen; i++) {
    if (!resultArray[i]) {
      printf("a");
    } else {
      printf("%c", resultArray[i]);
    }
  }
  return 0;
}
