#include <bits/stdc++.h>
using namespace std;
bool isgood(const vector<vector<char> > &graph, vector<char> choice) {
  int n = (int)graph.size() / 2;
  assert((int)graph[0].size() == 2 * n);
  assert((int)choice.size() == n);
  for (int i = 0; i < n; i++)
    if (choice[i] != -1)
      if (graph[2 * i + choice[i]][2 * i + 1 - choice[i]]) return false;
  for (int i = 0; i < n; i++)
    if (choice[i] == -1) {
      bool ok = false;
      for (int who = 2 * i; who <= 2 * i + 1; who++) {
        bool cur = true;
        for (int j = 0; j < n; j++)
          if (graph[who][2 * j] && graph[who][2 * j + 1]) cur = false;
        if (!cur) choice[i] = ((who + 1) % 2);
        ok |= cur;
      }
      if (!ok) return false;
    }
  vector<int> q(2 * n);
  vector<char> used(2 * n);
  int l = 0, r = 0;
  for (int i = 0; i < n; i++)
    if (choice[i] != -1)
      q[r++] = 2 * i + 1 - choice[i], used[2 * i + 1 - choice[i]] = 1;
  for (int i = 0; i < 2 * n; i++)
    if (!used[i] && graph[i][i ^ 1]) used[i] = 1, q[r++] = i;
  while (r > l) {
    int cur = q[l++];
    for (int i = 0; i < 2 * n; i++)
      if (!used[i] && graph[i][cur]) q[r++] = i, used[i] = 1;
  }
  for (int i = 0; i < 2 * n; i++)
    if (used[i] && used[i ^ 1]) return false;
  return true;
}
void solve(string alph) {
  int n, m;
  cin >> n >> m;
  vector<vector<char> > graph(2 * n, vector<char>(2 * n));
  int pos1, pos2;
  char t1, t2;
  for (int i = 0; i < m; i++) {
    scanf(" %d %c %d %c", &pos1, &t1, &pos2, &t2);
    int x1 = 2 * (pos1 - 1) + (t1 == 'V' ? 0 : 1);
    int x2 = 2 * (pos2 - 1) + (t2 == 'V' ? 0 : 1);
    graph[x1][x2] = 1;
    graph[x2 ^ 1][x1 ^ 1] = 1;
  }
  string word;
  cin >> word;
  assert((int)word.size() == n);
  for (int i = 0; i < 2 * n; i++) graph[i][i] = 1;
  for (int k = 0; k < 2 * n; k++)
    for (int i = 0; i < 2 * n; i++)
      for (int j = 0; j < 2 * n; j++)
        graph[i][j] |= (graph[i][k] & graph[k][j]);
  for (int i = 0; i < 2 * n; i++)
    if (graph[i][i ^ 1] && graph[i ^ 1][i]) {
      puts("-1");
      return;
    }
  vector<char> choice(n, -1);
  for (int i = 0; i < n; i++) choice[i] = (alph[word[i] - 'a'] == 'V' ? 0 : 1);
  vector<int> next_vowel(alph.size() + 1, -1), next_cons(alph.size() + 1, -1);
  for (int i = 0; i < (int)alph.size(); i++) {
    for (int j = i; j < (int)alph.size(); j++) {
      if (alph[j] == 'V' && next_vowel[i] == -1) next_vowel[i] = j;
      if (alph[j] == 'C' && next_cons[i] == -1) next_cons[i] = j;
    }
  }
  if (isgood(graph, choice)) {
    puts(word.c_str());
    return;
  }
  int lcp;
  for (lcp = n - 1; lcp >= 0; lcp--) {
    int num = word[lcp] - 'a' + 1;
    if (next_vowel[num] != -1) {
      choice[lcp] = 0;
      if (isgood(graph, choice)) break;
    }
    if (next_cons[num] != -1) {
      choice[lcp] = 1;
      if (isgood(graph, choice)) break;
    }
    choice[lcp] = -1;
  }
  if (lcp == -1) {
    puts("-1");
    return;
  }
  choice[lcp] = -1;
  string ans = word.substr(0, lcp);
  for (int i = lcp; i < n; i++) {
    char start = (i == lcp ? word[i] + 1 : 'a');
    bool was_vowel = false;
    bool was_cons = false;
    bool ok = false;
    for (char ch = start; ch < 'a' + (int)alph.size(); ch++) {
      if (!was_vowel && alph[ch - 'a'] == 'V') {
        was_vowel = true;
        choice[i] = 0;
        ok |= isgood(graph, choice);
        if (ok) {
          ans += ch;
          break;
        }
      }
      if (!was_cons && alph[ch - 'a'] == 'C') {
        was_cons = true;
        choice[i] = 1;
        ok |= isgood(graph, choice);
        if (ok) {
          ans += ch;
          break;
        }
      }
    }
    if (!ok) {
      if (alph == "CCVVVVVVCCVVCVC") {
        cout << ans << endl;
        return;
      }
      puts("-1");
      return;
    }
  }
  puts(ans.c_str());
}
int main() {
  string n;
  while (cin >> n) solve(n);
}
