#include <bits/stdc++.h>
int main() {
  unsigned tr;
  std::cin >> tr >> tr;
  std::string s;
  std::cin >> s;
  char tab['z' + 1];
  for (char i = 0; i <= 'z'; i++) {
    tab[i] = i;
  }
  while (tr-- > 0) {
    char a, b;
    std::cin >> a >> b;
    char oa = a, ob = b;
    while (tab[a] != oa) a = tab[a];
    while (tab[b] != ob) b = tab[b];
    std::swap(tab[a], tab[b]);
  }
  for (int i = 0; i < s.size(); i++) {
    std::cout << tab[s[i]];
  }
  std::cout << std::endl;
}
