#include <bits/stdc++.h>
using namespace std;
struct S {
  int a, b;
  S() {}
  S(int _a, int _b) {
    a = _a;
    b = _b;
  }
  const bool operator<(const S &o) const { return a < o.a; }
};
priority_queue<int, vector<int>, greater<int>> mpq;
const int SPACE = 0, NL = 1;
string exm;
inline void showAll(vector<int> &v, int sep) {
  for (int &here : v) printf("%d%c", here, (sep) ? '\n' : ' ');
}
inline void exf(void) {
  cout << exm << "\n";
  exit(0);
}
inline vector<int> int_seperation(int N, int d = 10) {
  vector<int> v;
  while (N) {
    v.push_back(N % d);
    N /= d;
  }
  reverse(v.begin(), v.end());
  return v;
}
const int SIZE = 2000009;
set<int> unused;
char ans[SIZE] = {0}, str[1000009] = {0};
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= 2000009; i++) unused.insert(i);
  while (n--) {
    scanf("%s", str + 1);
    int len = strlen(str + 1);
    int m;
    scanf("%d", &m);
    for (int i = 1; i <= m; i++) {
      int cur;
      scanf("%d", &cur);
      auto it = unused.lower_bound(cur);
      while (it != unused.end()) {
        if (*it >= cur + len) break;
        ans[*it] = str[*it - cur + 1];
        it = unused.erase(it);
      }
    }
  }
  int l;
  for (int i = 2000005; i >= 1; i--) {
    if (ans[i] != 0) {
      l = i;
      break;
    }
  }
  for (int i = 1; i <= l; i++) {
    if (ans[i] == 0)
      printf("a");
    else
      printf("%c", ans[i]);
  }
  return 0;
}
