#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e6 + 7;
const int INF = 0x7fffffff;
int n, m;
struct DATA {
  int strid;
  int index;
};
vector<DATA> vec;
string str[maxn];
char ans[maxn];
bool cmp(DATA a, DATA b) { return a.index < b.index; }
int main() {
  while (cin >> n) {
    memset(ans, 0, sizeof(ans));
    vec.clear();
    for (int i = 0; i < n; i++) {
      int num;
      cin >> str[i];
      scanf("%d", &num);
      for (int j = 0; j < num; j++) {
        int k;
        scanf("%d", &k);
        k--;
        DATA t;
        t.strid = i;
        t.index = k;
        vec.push_back(t);
      }
    }
    int last = -1;
    sort(vec.begin(), vec.end(), cmp);
    for (int i = 0; i < vec.size(); i++) {
      for (int j = max(last + 1, vec[i].index);
           j < vec[i].index + str[vec[i].strid].size(); j++) {
        ans[j] = str[vec[i].strid][j - vec[i].index];
        last = max(last, j);
      }
    }
    for (int i = 0; i <= last; i++) {
      if (ans[i] != 0)
        printf("%c", ans[i]);
      else {
        printf("a");
      }
    }
    puts("");
  }
  return 0;
}
