#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
template <typename T>
inline T BigMod(T A, T B, T M = MOD) {
  T ret = 1;
  while (B) {
    if (B & 1) ret = (ret * A) % M;
    A = (A * A) % M;
    B = B >> 1;
  }
  return ret;
}
template <typename T>
inline T EGCD(T a, T b, T &x, T &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  T x1, y1;
  T d = EGCD(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
template <typename T>
inline T LCM(T x, T y) {
  T g = __gcd(x, y);
  return (x / g) * y;
}
template <typename T>
inline T Distance(T x1, T y1, T x2, T y2) {
  return sqrt(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
}
template <typename T>
inline T Area(T Ax, T Ay, T Bx, T By, T Cx, T Cy) {
  T ret = Ax * (By - Cy) + Bx * (Cy - Ay) + Cx * (Ay - By);
  if (ret < 0) return ret = -ret;
  return ret;
}
bool Check(int N, int pos) { return (bool)(N & (1 << pos)); }
int Set(int N, int pos) { return (N | (1 << pos)); }
template <typename T>
inline T CRT(T num[], T rem[], T k) {
  T prod = 1, result = 0;
  for (T i = 0; i < k; i++) prod *= num[i];
  for (T i = 0; i < k; i++) {
    T pp = prod / num[i];
    result += rem[i] * inv(pp, num[i]) * pp;
  }
  return result % prod;
}
const int FacN = 100000;
long long Fac[FacN + 5];
void Facgen() {
  Fac[0] = 1;
  for (int i = 1; i <= FacN; i++) Fac[i] = (Fac[i - 1] * i) % MOD;
}
template <typename T>
inline T COM(T a, T b) {
  if (a < b) return 0;
  return ((Fac[a] * BigMod((Fac[b] * Fac[a - b]) % MOD, MOD - 2, MOD)) % MOD +
          MOD) %
         MOD;
}
const int N = 2100000;
int n;
string str[N + 5];
int k[N + 5];
vector<int> st[N + 5], ed[N + 5];
int pre[N + 5];
string s;
multiset<int> SET;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> str[i];
    cin >> k[i];
    for (int j = 1; j <= k[i]; j++) {
      int x;
      cin >> x;
      st[x].push_back(i);
      ed[x + str[i].size() - 1].push_back(i);
    }
  }
  int last = -1;
  for (int i = 1; i <= N; i++) {
    if (!st[i].empty()) {
      for (int j = 0; j < st[i].size(); j++) {
        SET.insert(st[i][j]);
        pre[st[i][j]] = i;
      }
    }
    if (SET.size() != 0) {
      last = i;
      int in = *SET.begin();
      int start = pre[in];
      int index = i - start;
      s += str[in][index];
    } else {
      s += "a";
    }
    for (int j = 0; j < ed[i].size(); j++) {
      auto it = SET.find(ed[i][j]);
      SET.erase(it);
    }
  }
  for (int i = 1; i <= last; i++) cout << s[i - 1];
  cout << "\n";
}
