#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000000 + 10;
string s[maxn];
int vis[maxn];
int len[maxn];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    memset(len, -1, sizeof(len));
    memset(vis, -1, sizeof(vis));
    int end_loc = 0;
    for (int i = 0; i < n; i++) {
      cin >> s[i];
      int y = s[i].length();
      int k;
      scanf("%d", &k);
      for (int j = 0; j < k; j++) {
        int loc;
        scanf("%d", &loc);
        if (y > len[loc]) {
          vis[loc] = i;
          len[loc] = s[i].length();
        }
        end_loc = max(end_loc, loc);
      }
    }
    int en = 0;
    for (int i = 1; i <= end_loc; i++) {
      if (vis[i] == -1) {
        if (i > en) {
          printf("a");
          en++;
        }
      } else if (vis[i] >= 0) {
        int id = vis[i];
        if (i > en) {
          cout << s[id];
          en += s[id].length();
        } else if (i <= en) {
          int x = 0;
          for (int j = en - i + 1; j < s[id].length(); j++) {
            x++;
            printf("%c", s[id][j]);
          }
          en += x;
        }
      }
    }
    printf("\n");
  }
  return 0;
}
