#include <bits/stdc++.h>
using namespace std;
int S[100008], cnt[1 << 7], num[1 << 7];
char s[100008];
int len, n, nu;
inline long long rd() {
  long long x = 0;
  char c = getchar();
  bool f = 0;
  while (!isdigit(c)) {
    if (c == '-') f = 1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  return f ? -x : x;
}
int main() {
  int ooo = 0;
  scanf("%s", s + 1);
  len = strlen(s + 1);
  int x;
  int maxn = (1 << 6) - 1;
  for (int i = 1; i <= len; ++i) {
    int x = s[i] - 'a';
    for (int j = 1; j <= maxn; ++j)
      if (j & (1 << x)) cnt[j]++;
  }
  n = rd();
  for (int i = 1; i <= n; ++i) {
    x = rd();
    scanf("%s", s + 1);
    int xx = strlen(s + 1);
    for (int j = 1; j <= xx; ++j) S[x] |= (1 << (s[j] - 'a'));
    for (int j = 1; j <= maxn; ++j)
      if ((j & S[x]) == S[x]) num[j]++;
  }
  for (int i = 1; i <= len; ++i)
    if (!S[i]) {
      S[i] = maxn;
      num[S[i]]++;
    }
  for (int i = 1; i <= len; ++i) {
    bool tag = 0;
    for (int j = 0; j < 6; ++j)
      if ((1 << j) & S[i]) {
        bool tg = 0;
        for (int k = 1; k <= maxn; ++k) {
          int x = (k & (1 << j)) ? cnt[k] - 1 : cnt[k],
              y = ((k & S[i]) == S[i]) ? num[k] - 1 : num[k];
          if (x < y) {
            tg = 1;
            break;
          }
        }
        if (!tg) {
          tag = 1;
          s[++nu] = j + 'a';
          for (int k = 1; k <= maxn; ++k) {
            if ((1 << j) & k) cnt[k]--;
            if ((S[i] & k) == S[i]) num[k]--;
          }
          break;
        }
      }
    if (!tag) {
      puts("Impossible");
      return 0;
    }
  }
  for (int i = 1; i <= nu; ++i) printf("%c", s[i]);
  int yyy = 0;
  return 0;
}
