#include <bits/stdc++.h>
using namespace std;
map<char, int> freqs;
map<char, vector<int> > indexes;
multimap<char, int> input;
int main(int argc, char** argv) {
  int k = 0, n = 0;
  string s;
  cin >> k >> s >> n;
  for (int i = 0; i < s.length(); i++) {
    ++freqs[s[i]];
  }
  char c = 0;
  int t = 0;
  for (int i = 0; i < n; i++) {
    cin >> t >> c;
    input.insert(make_pair(c, t));
  }
  char c_pred = 0;
  multimap<char, int>::iterator it = input.begin();
  int M[2000][100 + 1] = {0};
  for (it; it != input.end(); it++) {
    if ((it->first) != c_pred)
      for (int i = 0; i < k; i++) M[i][s.length()] = freqs[it->first];
    int i1 = -1, j1 = s.length(), sum = 0;
    while ((sum += M[(++i1)][s.length()]) < it->second)
      ;
    while ((--j1) >= 0) {
      if ((s[j1] == it->first) && (M[i1][j1] == 0)) --sum;
      if (sum < it->second) break;
    }
    ++M[i1][j1];
    --M[i1][s.length()];
    c_pred = it->first;
  }
  for (int i = 0; i < k; i++)
    for (int j = 0; j < s.length(); j++)
      if (M[i][j] == 0) cout << s[j];
  return 0;
}
