#include <bits/stdc++.h>
using namespace std;
inline void getInt(int* p);
string str[10000010];
struct node {
  int id;
  int x;
} now;
vector<node> v;
bool cmp(node a, node b) {
  if (a.x == b.x) {
    return str[a.id].length() > str[b.id].length();
  } else {
    return a.x < b.x;
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  int n, m;
  cin >> n;
  v.clear();
  for (int i = 0; i <= n - 1; i++) {
    cin >> str[i] >> m;
    now.id = i;
    for (int j = 0; j <= m - 1; j++) {
      cin >> now.x;
      v.push_back(now);
    }
  }
  sort(v.begin(), v.end(), cmp);
  int len = v.size();
  int num = 1;
  for (int i = 0; i < len; i++) {
    now = v[i];
    while (num < now.x) {
      num++;
      cout << "a";
    }
    if (num != now.x) {
      if (num > now.x + str[now.id].length()) {
        continue;
      }
      for (int j = num - now.x; j < str[now.id].length(); j++) {
        cout << str[now.id][j];
        num++;
      }
    } else {
      cout << str[now.id];
      num += str[now.id].length();
    }
  }
  return 0;
}
inline void getInt(int* p) {
  char ch;
  do {
    ch = getchar();
  } while (ch == ' ' || ch == '\n');
  if (ch == '-') {
    *p = -(getchar() - '0');
    while ((ch = getchar()) >= '0' && ch <= '9') {
      *p = *p * 10 - ch + '0';
    }
  } else {
    *p = ch - '0';
    while ((ch = getchar()) >= '0' && ch <= '9') {
      *p = *p * 10 + ch - '0';
    }
  }
}
