package ru.spbau.mit

import java.util.*

data class Request(
        val p: Int,
        val c: Char
)

class Solver {
    class Segment(
            private val leftPosition: Int,
            private val rightPosition: Int
    ) {
        private var count = 0
        private var leftChild: Segment? = null
        private var rightChild: Segment? = null

        init {
            if (leftPosition < rightPosition) {
                val middlePosition = (leftPosition + rightPosition) / 2
                leftChild = Segment(leftPosition, middlePosition)
                rightChild = Segment(middlePosition + 1, rightPosition)
            }
        }

        fun getPositionOf(k: Int): Int? {
            if (leftPosition == rightPosition)
                return if (count == 0) null else leftPosition
            return when (leftChild!!.count >= k) {
                true -> leftChild!!.getPositionOf(k)
                false -> rightChild!!.getPositionOf(k - leftChild!!.count)
            }
        }

        fun add(position: Int, delta: Int) {
            if (leftPosition == rightPosition)
                count += delta
            else {
                if (position <= leftChild!!.rightPosition) {
                    leftChild!!.add(position, delta)
                } else {
                    rightChild!!.add(position, delta)
                }
                count = leftChild!!.count + rightChild!!.count
            }
        }
    }

    fun solve(k: Int, s: String, requests: Array<Request>): String {
        val length = k * s.length
        val trees = Array(26, { Segment(0, length - 1) })
        for (i in 0 until k)
            for (j in 0 until s.length) {
                val index = s[j] - 'a'
                val position = i * s.length + j
                trees[index].add(position, 1)
            }
        for ((p, c) in requests) {
            val index = c - 'a'
            val position = trees[index].getPositionOf(p)
            trees[index].add(position!!, -1)
        }
        val totalString = Array(length, { ' ' })
        for (letter in 'a'..'z') {
            val index = letter - 'a'
            while (true) {
                val position = trees[index].getPositionOf(1)
                position ?: break
                totalString[position] = letter
                trees[index].add(position, -1)
            }
        }
        return totalString.filter { c -> c != ' ' }.toCharArray().joinToString("")
    }
}

fun main(args: Array<String>) {
    val input = Scanner(System.`in`)
    val k = input.nextInt()
    val s = input.next()
    val n = input.nextInt()
    val requests = Array(n,
            { Request(input.nextInt(), input.next().single()) })
    println(Solver().solve(k, s, requests))
}


import java.util.*

data class Request(
        val p: Int,
        val c: Char
)

class Solver {
    class SegmentTree(
            private val size: Int
    ) {
        private val tree = Array(size * 4, { 0 })

        private fun getPositionOf(v: Int, l: Int, r: Int, k: Int): Int? {
            if (l == r)
                return if (tree[v] == 0) null else l
            val m = (l + r) / 2
            return when (tree[v * 2 + 1] >= k) {
                true -> getPositionOf(v * 2 + 1, l, m, k)
                false -> getPositionOf(v * 2 + 2, m + 1, r, k - tree[v * 2 + 1])
            }
        }

        fun getPositionOf(k: Int) = getPositionOf(0, 0, size - 1, k)

        private fun add(v: Int, l: Int, r: Int, position: Int, delta: Int) {
            if (l == r)
                tree[v] += delta
            else {
                val m = (l + r) / 2
                if (position <= m) {
                    add(v * 2 + 1, l, m, position, delta)
                } else {
                    add(v * 2 + 2, m + 1, r, position, delta)
                }
                tree[v] = tree[v * 2 + 1] + tree[v * 2 + 2]
            }
        }

        fun add(position: Int, delta: Int) = add(0, 0, size - 1, position, delta)
    }

    fun solve(k: Int, s: String, requests: Array<Request>): String {
        val length = k * s.length
        val trees = Array(26, { SegmentTree(length) })
        for (i in 0 until k)
            for (j in 0 until s.length) {
                val index = s[j] - 'a'
                val position = i * s.length + j
                trees[index].add(position, 1)
            }
        for ((p, c) in requests) {
            val index = c - 'a'
            val position = trees[index].getPositionOf(p)
            trees[index].add(position!!, -1)
        }
        val totalString = Array(length, { ' ' })
        for (letter in 'a'..'z') {
            val index = letter - 'a'
            while (true) {
                val position = trees[index].getPositionOf(1)
                position ?: break
                totalString[position] = letter
                trees[index].add(position, -1)
            }
        }
        return totalString.filter { c -> c != ' ' }.toCharArray().joinToString("")
    }
}

fun main(args: Array<String>) {
    val input = Scanner(System.`in`)
    val k = input.nextInt()
    val s = input.next()
    val n = input.nextInt()
    val requests = Array(n,
            { Request(input.nextInt(), input.next().single()) })
    println(Solver().solve(k, s, requests))
}


import java.util.*

data class Request(
        val p: Int,
        val c: Char
)

class Solver {
    class Segment(
            private val leftPosition: Int,
            private val rightPosition: Int
    ) {
        private var count = 0
        private var leftChild: Segment? = null
        private var rightChild: Segment? = null

        init {
            if (leftPosition < rightPosition) {
                val middlePosition = (leftPosition + rightPosition) / 2
                leftChild = Segment(leftPosition, middlePosition)
                rightChild = Segment(middlePosition + 1, rightPosition)
            }
        }

        fun getPositionOf(k: Int): Int? {
            if (leftPosition == rightPosition)
                return if (count == 0) null else leftPosition
            return when (leftChild!!.count >= k) {
                true -> leftChild!!.getPositionOf(k)
                false -> rightChild!!.getPositionOf(k - leftChild!!.count)
            }
        }

        fun add(position: Int, delta: Int) {
            if (leftPosition == rightPosition)
                count += delta
            else {
                if (position <= leftChild!!.rightPosition) {
                    leftChild!!.add(position, delta)
                } else {
                    rightChild!!.add(position, delta)
                }
                count = leftChild!!.count + rightChild!!.count
            }
        }
    }

    fun solve(k: Int, s: String, requests: Array<Request>): String {
        val length = k * s.length
        val trees = Array(26, { Segment(0, length - 1) })
        for (i in 0 until k)
            for (j in 0 until s.length) {
                val index = s[j] - 'a'
                val position = i * s.length + j
                trees[index].add(position, 1)
            }
        for ((p, c) in requests) {
            val index = c - 'a'
            val position = trees[index].getPositionOf(p)
            trees[index].add(position!!, -1)
        }
        val totalString = Array(length, { ' ' })
        for (letter in 'a'..'z') {
            val index = letter - 'a'
            while (true) {
                val position = trees[index].getPositionOf(1)
                position ?: break
                totalString[position] = letter
                trees[index].add(position, -1)
            }
        }
        return totalString.filter { c -> c != ' ' }.toCharArray().joinToString("")
    }
}

fun main(args: Array<String>) {
    val input = Scanner(System.`in`)
    val k = input.nextInt()
    val s = input.next()
    val n = input.nextInt()
    val requests = Array(n,
            { Request(input.nextInt(), input.next().single()) })
    println(Solver().solve(k, s, requests))
}


import java.util.*

/**
 * An implementation of fenwick tree which enables to increase an array element and to calculate the sum of elements
 * on each array prefix. Both of them take O(log n) operations.
 * @param
 */
class FenwickTree(private val size: Int) {

    private val array: IntArray = IntArray(size + 1)

    /**
     * Increase the array element on the given position.
     * The elements are indexed from 1 to size (inclusive).
     * Time complexity: O(log n)
     */
    fun inc(position: Int) {
        var i: Int = position
        while (i <= size) {
            array[i]++
            i += i and (-i)
        }
    }

    /**
     * Calculate the sum of array element from 1 to rightBorder (inclusive).
     * Time complexity: O(log n)
     */
    fun getPrefixSum(rightBorder: Int): Int {
        var result = 0
        var i: Int = rightBorder
        while (i >= 1) {
            result += array[i]
            i -= i and (-i)
        }
        return result
    }
}

/**
 * An editor of nickName. Enables to delete i-th occurrence of a letter in
 * some string repeated k times.
 */
class NameEditor(private val basicString: String, private val numberOfCopies: Int) {

    private val alphabetSize = 26
    private val maxLength = 200000
    private fun Char.inAlphabet(): Int = this - 'a'
    private val letterOccurrences: Array<IntArray> = Array(alphabetSize, { c1 ->
        basicString.withIndex()
                .filter { x -> x.value.inAlphabet() == c1 }
                .map { x -> x.index }
                .toIntArray()
    })
    private val isRemoved: BooleanArray = BooleanArray(numberOfCopies * basicString.length)
    private val letterChanges: Array<FenwickTree> = Array(alphabetSize, { FenwickTree(maxLength) }) // letter -> fenwick tree of changes

    /**
     * Perform the query: remove a symbol.
     */
    fun edit(query: Query) {

        val (index, symbol) = query

        var l = 0
        var r = maxLength

        while (r - l > 1) {
            val m: Int = (l + r) / 2
            if (m - letterChanges[symbol.inAlphabet()].getPrefixSum(m) < index) {
                l = m
            } else {
                r = m
            }
        }

        val truePosition = r - 1
        letterChanges[symbol.inAlphabet()].inc(truePosition + 1)
        val perWord: Int = letterOccurrences[symbol.inAlphabet()].size
        val inResultingWord = (truePosition / perWord) * basicString.length +
                letterOccurrences[symbol.inAlphabet()][truePosition % perWord]
        isRemoved[inResultingWord] = true
    }

    /**
     * Get the resulting string after performing the queries.
     */
    fun getResult(): String {
        return basicString.repeat(numberOfCopies).filterIndexed { index, _ -> !isRemoved[index] }
    }

    /**
     * A class describing deletion query.
     * @param index - number of the symbol occurrence to delete.
     * @param symbol - letter to delete
     */
    data class Query(val index: Int, val symbol: Char)
}

/**
 * Solve the problem: perform given queries and return the resulting string.
 */
fun solve(k: Int, string: String, queries: List<NameEditor.Query>): String {
    val editor = NameEditor(string, k)
    queries.forEach { editor.edit(it) }
    return editor.getResult()
}

fun main(args: Array<String>) {
    val k = Integer.parseInt(readLine())
    val string = readLine().orEmpty()
    val n = Integer.parseInt(readLine())
    val queries: List<NameEditor.Query> = List(n, { _ ->
        val tokenizer = StringTokenizer(readLine())
        NameEditor.Query(Integer.parseInt(tokenizer.nextToken()), tokenizer.nextToken().first())
    })

    println(solve(k, string, queries))
}


import java.util.*

class FenwickTree(val size: Int) {
    val array: IntArray = kotlin.IntArray(size + 1)

    fun inc(position: Int) {
        var i: Int = position
        while (i <= size) {
            array[i]++
            i += i and (-i)
        }
    }

    fun getPrefixSum(rightBorder: Int): Int {
        var result: Int = 0
        var i: Int = rightBorder
        while (i >= 1) {
            result += array[i]
            i -= i and (-i)
        }
        return result
    }
}

fun solve(k: Int, string: String, n: Int, queries: List<Pair<Int, Char>>): String {
    val len = string.length

    fun Char.inAlphabet(): Int = this - 'a'
//    val letterOccurrences: IntArray = kotlin.IntArray(26, { c1 -> string.count { c2 -> c2 - 'a' == c1 } })
    val letterOccurrences: Array<IntArray> = kotlin.Array(26, { c1 ->
        string.withIndex()
                .filter { x -> x.value.inAlphabet() == c1 }
                .map { x -> x.index }
                .toIntArray()
    })

    val removed: BooleanArray = kotlin.BooleanArray(k * len)
    val letterChanges: Array<FenwickTree> = Array(26, { FenwickTree(200000) }) // letter -> fenwick tree of changes

    for ((position, symbol) in queries) {

        var l: Int = 0
        var r: Int = 200000

        while (r - l > 1) {
            val m: Int = (l + r) / 2
            if (m - letterChanges[symbol.inAlphabet()].getPrefixSum(m) < position) {
                l = m
            } else {
                r = m
            }
        }

        val realPosition = r - 1
        letterChanges[symbol.inAlphabet()].inc(realPosition + 1)
        val perWord: Int = letterOccurrences[symbol.inAlphabet()].size
        removed[(realPosition / perWord) * len + letterOccurrences[symbol.inAlphabet()][realPosition % perWord]] = true
    }

    return string.repeat(k).filterIndexed { index, _ -> !removed[index] }
}

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)

    val k = scanner.nextInt()
    scanner.nextLine()
    val string = scanner.nextLine().orEmpty()

    val n = scanner.nextInt()
    scanner.nextLine()

    val queries: List<Pair<Int, Char>> = List(n, { _ ->
        val tokenizer: StringTokenizer = StringTokenizer(scanner.nextLine())
        Pair(Integer.parseInt(tokenizer.nextToken()), tokenizer.nextToken().first()) })

    println(solve(k, string, n, queries))
}


import java.util.*

class FenwickTree(val size: Int) {
    val array: IntArray = kotlin.IntArray(size + 1)

    fun inc(position: Int) {
        var i: Int = position
        while (i <= size) {
            array[i]++
            i += i and (-i)
        }
    }

    fun getPrefixSum(rightBorder: Int): Int {
        var result: Int = 0
        var i: Int = rightBorder
        while (i >= 1) {
            result += array[i]
            i -= i and (-i)
        }
        return result
    }
}

fun solve(k: Int, string: String, n: Int, queries: List<Pair<Int, Char>>): String {
    val len = string.length

//    val letterOccurrences: IntArray = kotlin.IntArray(26, { c1 -> string.count { c2 -> c2 - 'a' == c1 } })
    val letterOccurrences: Array<IntArray> = kotlin.Array(26, { c1 ->
        string.withIndex()
                .filter { x -> x.value == 'a' + c1 }
                .map { x -> x.index }
                .toIntArray()
    })

    val removed: BooleanArray = kotlin.BooleanArray(k * len)
    val letterChanges: Array<FenwickTree> = Array(26, { FenwickTree(200000) }) // letter -> fenwick tree of changes

    for ((position, symbol) in queries) {
        val realPosition = position + letterChanges[symbol - 'a'].getPrefixSum(position) - 1
//        println(realPosition)
        letterChanges[symbol - 'a'].inc(position)
        val perWord: Int = letterOccurrences[symbol - 'a'].size
//        println(perWord)
        removed[(realPosition / perWord) * len + letterOccurrences[symbol - 'a'][realPosition % perWord]] = true
    }

    return string.repeat(k).filterIndexed { index, _ -> !removed[index] }
}

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)

    val k = scanner.nextInt()
    scanner.nextLine()
    val string = scanner.nextLine().orEmpty()

    val n = scanner.nextInt()
    scanner.nextLine()

    val queries: List<Pair<Int, Char>> = List(n, { _ ->
        val tokenizer: StringTokenizer = StringTokenizer(scanner.nextLine())
        Pair(Integer.parseInt(tokenizer.nextToken()), tokenizer.nextToken().first()) })

    println(solve(k, string, n, queries))
}


import java.util.*

class FenwickTree(val size: Int) {
    val array: IntArray = kotlin.IntArray(size + 1)

    fun inc(position: Int) {
        var i: Int = position
        while (i <= size) {
            array[i]++
            i += i and (-i)
        }
    }

    fun getPrefixSum(rightBorder: Int): Int {
        var result: Int = 0
        var i: Int = rightBorder
        while (i >= 1) {
            result += array[i]
            i -= i and (-i)
        }
        return result
    }
}

fun solve(k: Int, string: String, n: Int, queries: List<Pair<Int, Char>>): String {
    val len = string.length

//    val letterOccurrences: IntArray = kotlin.IntArray(26, { c1 -> string.count { c2 -> c2 - 'a' == c1 } })
    val letterOccurrences: Array<IntArray> = kotlin.Array(26, { c1 ->
        string.withIndex()
                .filter { x -> x.value == 'a' + c1 }
                .map { x -> x.index }
                .toIntArray()
    })

    val removed: BooleanArray = kotlin.BooleanArray(k * len)
    val letterChanges: Array<FenwickTree> = Array(26, { FenwickTree(200000) }) // letter -> fenwick tree of changes

    for ((position, symbol) in queries) {
        val realPosition = position + letterChanges[symbol - 'a'].getPrefixSum(position) - 1
//        println(realPosition)
        letterChanges[symbol - 'a'].inc(realPosition + 1)
        val perWord: Int = letterOccurrences[symbol - 'a'].size
//        println(perWord)
        removed[(realPosition / perWord) * len + letterOccurrences[symbol - 'a'][realPosition % perWord]] = true
    }

    return string.repeat(k).filterIndexed { index, _ -> !removed[index] }
}

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)

    val k = scanner.nextInt()
    scanner.nextLine()
    val string = scanner.nextLine().orEmpty()

    val n = scanner.nextInt()
    scanner.nextLine()

    val queries: List<Pair<Int, Char>> = List(n, { _ ->
        val tokenizer: StringTokenizer = StringTokenizer(scanner.nextLine())
        Pair(Integer.parseInt(tokenizer.nextToken()), tokenizer.nextToken().first()) })

    println(solve(k, string, n, queries))
}


fun main() {
    var p = 0
    val gh = Array<Char>(200001) { ' ' }
    val h = HashMap<Char, ArrayList<Int>>()
    System.`in`.bufferedReader().use { reader ->
        val k = reader.readLine().toInt()
        val string = reader.readLine()
        val n = reader.readLine().toInt()

        for (i in 0 until k) {
            for (char in string) {
                gh[p] = char
                h.getOrPut(char, { ArrayList() }).add(p)
                p++
            }
        }

        for (i in 0 until n) {
            val (aStr, bStr) = reader.readLine().split(" ")
            val a = aStr.toInt()
            val b = bStr.single()

            gh[h[b]!![a - 1]] = '-'
            h[b]!!.removeAt(a - 1)
        }

        for (i in 0 until p) {
            if (gh[i] != '-') print(gh[i])
        }
    }
}


import java.util.*
import kotlin.collections.ArrayList

fun main() {
    var p = 0
    val gh = Array<Char>(200001) { ' ' }
    val h = ArrayList<ArrayList<Int>>()
    (1..30).forEach { _ -> h.add(ArrayList()) }
    Scanner(System.`in`.bufferedReader()).use { scanner ->
        val k = scanner.nextInt()
        scanner.nextLine()
        val string = scanner.nextLine()
        val n = scanner.nextInt()

        for (i in 0 until k) {
            for (j in string.indices) {
                gh[p] = string[j]
                h[string[j].toInt() - 96].add(p)
                p++
            }
        }

        for (i in 0 until n) {
            val a = scanner.nextInt()
            val b = scanner.next().single()
            gh[h[b.toInt() - 96][a - 1]] = '-'
            h[b.toInt() - 96].remove(a - 1)
        }

        for (i in 0 until p) {
            if (gh[i] != '-') print(gh[i])
        }
    }
}


fun main() {
    var p = 0
    val gh = Array<Char>(200001) { ' ' }
    val h = ArrayList<ArrayList<Int>>()
    (1..30).forEach { _ -> h.add(ArrayList()) }
    Scanner(System.`in`.bufferedReader()).use { scanner ->
        val k = scanner.nextInt()
        scanner.nextLine()
        val string = scanner.nextLine()
        val n = scanner.nextInt()

        for (i in 0 until k) {
            for (j in string.indices) {
                gh[p] = string[j]
                h[string[j].toInt() - 96].add(p)
                p++
            }
        }

        for (i in 0 until n) {
            val a = scanner.nextInt()
            val b = scanner.next().single()
            gh[h[b.toInt() - 96][a - 1]] = '-'
            h[b.toInt() - 96].remove(a - 1)
        }

        for (i in 0 until p) {
            if (gh[i] != '-') print(gh[i])
        }
    }
}


import java.io.InputStream
import java.util.*
import kotlin.collections.ArrayList
import kotlin.collections.HashMap

fun Scanner.nextChar() = next().single()

object Solver {
    fun solve(input: InputStream): String {

        val newString = Array(200001) { ' ' }
        val lettersToIndices = HashMap<Char, ArrayList<Int>>()

        return Scanner(input.bufferedReader()).use { scanner ->
            val k = scanner.nextInt()
            val string = scanner.next()
            val n = scanner.nextInt()

            var p = 0
            for (i in 0 until k) {
                for (char in string) {
                    newString[p] = char
                    lettersToIndices.getOrPut(char, { ArrayList() }).add(p)
                    p++
                }
            }

            for (i in 0 until n) {
                val aInd = scanner.nextInt() - 1
                val b = scanner.nextChar()

                newString[lettersToIndices[b]!![aInd]] = '!'
                lettersToIndices[b]!!.removeAt(aInd)
            }

            buildString {
                newString.asSequence()
                        .take(p)
                        .filter { it != '!' }
                        .forEach {
                            append(it)
                        }
            }
        }
    }
}

fun main() = println(Solver.solve(System.`in`))


import java.io.FileReader
import java.util.*

const val LETTERS_IN_ENGLISH = 26
val p = Array(LETTERS_IN_ENGLISH) { mutableListOf<Int>() }

fun letterToInt(c : Char): Int {
    return c - 'a'
}

fun intToLetter(i : Int) : Char {
    return 'a' + i
}

fun main() {
    val input = Scanner(System.`in`)

    input.use {
        val k = input.nextInt()
        input.nextLine()
        val s = input.nextLine()

        var currentPos = 0
        for (i in 1..k) {
            for (c in s) {
                p[letterToInt(c)].add(currentPos)
                currentPos++
            }
        }

        val n = input.nextInt()

        for (i in 1..n) {
            val pos = input.nextInt()
            val letter = input.next()[0]

            p[letterToInt(letter)].removeAt(pos - 1)
        }

        val resultName = CharArray(k * s.length)

        for (i in 0 until LETTERS_IN_ENGLISH) {
            for (j in p[i]) {
                resultName[j] = intToLetter(i)
            }
        }

        for (c in resultName) {
            if (c != Character.MIN_VALUE) {
                print(c)
            }
        }
    }
}


import java.util.*

const val LETTERS_IN_ENGLISH = 26

/**
 * Converts english letters to it's indexes in the english alphabet (from 0) without
 * boundary checks
 */
fun letterToIndex(c : Char): Int {
    return c - 'a'
}

/**
 * Converts an index in the english alphabet to the corresponding english letter
 * without boundary checks
 */
fun indexToLetter(i : Int) : Char {
    return 'a' + i
}

fun solveProblem() : String {
    val result = StringBuilder()

    val input = Scanner(System.`in`)

    input.use {
        val k = input.nextInt()
        input.nextLine()
        val s = input.nextLine()

        val lettersPositions = Array(LETTERS_IN_ENGLISH) { mutableListOf<Int>() }

        var currentPosition = 0
        for (i in 1..k) {
            for (c in s) {
                lettersPositions[letterToIndex(c)].add(currentPosition)
                currentPosition++
            }
        }

        val n = input.nextInt()

        for (i in 1..n) {
            val pos = input.nextInt()
            val letter = input.next()[0]

            lettersPositions[letterToIndex(letter)].removeAt(pos - 1)
        }

        val resultName = CharArray(k * s.length)

        for (i in 0 until LETTERS_IN_ENGLISH) {
            for (j in lettersPositions[i]) {
                resultName[j] = indexToLetter(i)
            }
        }

        for (c in resultName) {
            if (c != Character.MIN_VALUE) {
                result.append(c)
            }
        }
    }

    return result.toString()
}

fun main() {
    print(solveProblem())
}


import java.util.*

const val LETTERS_IN_ENGLISH = 26

/**
 * Converts english letters to it's indexes in the english alphabet (from 0) without
 * boundary checks
 */
fun letterToIndex(c: Char): Int {
    return c - 'a'
}

/**
 * Converts an index in the english alphabet to the corresponding english letter
 * without boundary checks
 */
fun indexToLetter(i: Int): Char {
    return 'a' + i
}

fun solveProblem(): String {
    val result = StringBuilder()

    val input = Scanner(System.`in`)

    input.use {
        val k = input.nextInt()
        input.nextLine()
        val s = input.nextLine()

        val lettersPositions = Array(LETTERS_IN_ENGLISH) { mutableListOf<Int>() }

        var currentPosition = 0
        for (i in 1..k) {
            for (c in s) {
                lettersPositions[letterToIndex(c)].add(currentPosition)
                currentPosition++
            }
        }

        val n = input.nextInt()

        for (i in 1..n) {
            val pos = input.nextInt()
            val letter = input.next()[0]

            lettersPositions[letterToIndex(letter)].removeAt(pos - 1)
        }

        val resultName = CharArray(k * s.length)

        for (i in 0 until LETTERS_IN_ENGLISH) {
            for (j in lettersPositions[i]) {
                resultName[j] = indexToLetter(i)
            }
        }

        for (c in resultName) {
            if (c != Character.MIN_VALUE) {
                result.append(c)
            }
        }
    }

    return result.toString()
}

fun main() {
    print(solveProblem())
}


import java.util.*
import kotlin.collections.HashMap
import kotlin.collections.HashSet

class NameStorage(s: String, k: Int) {
    private val orders: Map<Char, LinkedList<Int>>
    private val kString = StringBuilder()
    private val removed = HashSet<Int>()

    init {
        for (i in 1..k) {
            kString.append(s)
        }

        val mutOrders: MutableMap<Char, LinkedList<Int>> = HashMap()
        kString.forEachIndexed { index, c ->
            val order = mutOrders.getOrPut(c, { LinkedList() } )
            order.addLast(index)
        }

        orders = mutOrders
    }

    fun remove(c: Char, order: Int) {
        val order = order - 1
        val toRemove = orders[c]?.get(order)

        when (toRemove) {
            null -> throw Exception("incorrect command")
            else -> {
                orders[c]?.removeAt(order)
                removed.add(toRemove)
            }
        }
    }

    val name: String
        get() = kString.filterIndexed { index, _ -> !removed.contains(index) }.toString()
}

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val k = scanner.nextInt()
    val s = scanner.next()!!
    val nameStorage = NameStorage(s, k)

    val n = scanner.nextInt()

    for (i in 1..n) {
        val o = scanner.nextInt()
        val c = scanner.next()?.get(0)!!
        nameStorage.remove(c, o)
    }

    println(nameStorage.name)
}


import java.util.*
import kotlin.collections.HashMap

class NameStorage(s: String, k: Int) {
    private val orders: MutableMap<Char, LinkedList<Int>> = HashMap()
    private val removed = BitSet(k * s.length)
    private val kString = StringBuilder()

    init {
        for (i in 1..k) {
            kString.append(s)
        }

        kString.forEachIndexed { index, c ->
            val order = orders.getOrPut(c, { LinkedList() } )
            order.addLast(index)
        }
    }

    fun remove(c: Char, order: Int) {
        val order = order - 1
        val toRemove = orders[c]?.get(order)

        when (toRemove) {
            null -> throw Exception("incorrect command")
            else -> {
                removed.set(toRemove)
                orders[c]?.removeAt(order)
            }
        }
    }

    val name: String
        get() = kString.filterIndexed { index, _ -> !removed[index] }.toString()
}

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val k = scanner.nextInt()
    val s = scanner.next()!!
    val nameStorage = NameStorage(s, k)

    val n = scanner.nextInt()

    for (i in 1..n) {
        val o = scanner.nextInt()
        val c = scanner.next()?.get(0)!!
        nameStorage.remove(c, o)
    }

    println(nameStorage.name)
}


import java.util.*
import kotlin.collections.HashMap
import kotlin.collections.HashSet

class NameStorage(s: String, k: Int) {
    private val orders: Map<Char, ArrayList<Int>>
    private val kString = StringBuilder()
    private val removed = HashSet<Int>()

    init {
        for (i in 1..k) {
            kString.append(s)
        }

        val mutOrders: HashMap<Char, ArrayList<Int>> = HashMap()
        kString.forEachIndexed { index, c ->
            val order = mutOrders.getOrPut(c, { ArrayList() } )
            order.add(index)
        }

        orders = mutOrders
    }

    fun remove(c: Char, order: Int) {
        val order = order - 1
        val toRemove = orders[c]?.get(order)

        when (toRemove) {
            null -> throw Exception("incorrect command")
            else -> {
                orders[c]?.removeAt(order)
                removed.add(toRemove)
            }
        }
    }

    val name: String
        get() = kString.filterIndexed { index, _ -> !removed.contains(index) }.toString()
}

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val k = scanner.nextInt()
    val s = scanner.next()!!
    val nameStorage = NameStorage(s, k)

    val n = scanner.nextInt()

    for (i in 1..n) {
        val o = scanner.nextInt()
        val c = scanner.next()?.get(0)!!
        nameStorage.remove(c, o)
    }

    println(nameStorage.name)
}


//package ru.hse.spb

import java.util.*
import kotlin.collections.HashMap
import kotlin.random.Random

class Treap {
    private var root: TreapNode? = null
    private var rightmostNode: TreapNode? = null

    fun print() {
        root?.print()
    }

    fun put(newKey: Int) {
        val newNode = TreapNode(newKey, null)

        if (root == null) {
            root = newNode
            rightmostNode = root
            return
        }

        when {
            root!!.priority <= newNode.priority -> {
                newNode.leftChild = root
                root!!.parent = newNode
                root = newNode
                rightmostNode = root
            }
            rightmostNode!!.priority >= newNode.priority -> {
                rightmostNode!!.rightChild = newNode
                newNode.parent = rightmostNode
                rightmostNode = newNode
            }
            else -> {
                var curNode = rightmostNode
                while (curNode!!.priority < newNode.priority) {
                    curNode = curNode.parent
                }

                newNode.leftChild = curNode.rightChild
                curNode.rightChild?.parent = newNode

                curNode.rightChild = newNode
                newNode.parent = curNode

                rightmostNode = newNode
            }
        }

        var curNode: TreapNode? = newNode
        while (curNode != root) {
            curNode?.updateSize()
            curNode = curNode!!.parent
        }

        curNode?.updateSize()
    }

    fun delete(delKey: Int): Int {
        val (left, right) = root!!.split(delKey)
        val (toDelete, finalRight) = right?.split(1) ?: Pair(null, null)

        if (toDelete == rightmostNode) {
            rightmostNode
        }

        root = TreapNode.merge(left, finalRight)

        var curNode = root

        while (curNode?.rightChild != null) {
            curNode = curNode.rightChild
        }

        rightmostNode = curNode
        return toDelete?.key ?: -1
    }

    fun get(getKey: Int): Int {
        val (left, right) = root!!.split(getKey)
        val (res, rightmost) = right!!.split(1)
        root = TreapNode.merge(left, TreapNode.merge(res, rightmost))

        return res!!.key
    }

    class TreapNode(internal val key: Int, internal var parent: TreapNode? = null) {
        internal val priority: Long = Random.nextLong()
        internal var leftChild: TreapNode? = null
        internal var rightChild: TreapNode? = null
        var subtreeSize: Int = 1

        companion object {
            fun merge(left: TreapNode?, right: TreapNode?): TreapNode? {
                if (left == null) {
                    right?.parent = null
                    return right
                }

                if (right == null) {
                    left.parent = null
                    return left
                }

                return if (left.priority > right.priority) {
                    val merged = merge(left.rightChild, right)
                    left.rightChild = merged
                    left.rightChild!!.parent = left
                    left.parent = null
                    left.updateSize()
                    left
                } else {
                    val merged = merge(left, right.leftChild)
                    right.leftChild = merged
                    right.leftChild!!.parent = right
                    right.parent = null
                    right.updateSize()
                    right
                }
            }
        }

        internal fun updateSize() {
            val leftSize = if (leftChild == null) 0 else leftChild!!.subtreeSize
            val rightSize = if (rightChild == null) 0 else rightChild!!.subtreeSize

            subtreeSize = 1 + leftSize + rightSize
        }

        internal fun print() {
            leftChild?.print()
            print("$key ")
            rightChild?.print()
        }

        internal fun split(splitKey: Int, add: Int = 0): Pair<TreapNode?, TreapNode?> {
            val currentKey = add + if (leftChild == null) 0 else leftChild!!.subtreeSize
            val retNode = this

            if (splitKey <= currentKey) {
                if (leftChild == null) {
                    this.parent = null
                    return Pair(null, this)
                }

                val (left, right) = leftChild!!.split(splitKey, add)

                retNode.leftChild = right
                right?.parent = retNode
                retNode.rightChild = rightChild
                rightChild?.parent = retNode

                retNode.updateSize()

                left?.parent = null
                return Pair(left, retNode)
            } else {
                if (rightChild == null) {
                    this.parent = null
                    return Pair(this, null)
                }

                val (left, right) = rightChild!!.split(splitKey, add + 1 +
                        if (leftChild == null) 0 else leftChild!!.subtreeSize)

                retNode.leftChild = leftChild
                leftChild?.parent = retNode
                retNode.rightChild = left
                left?.parent = retNode

                retNode.updateSize()

                right?.parent = null
                return Pair(retNode, right)
            }
        }
    }
}

class CompetitiveIO {
    companion object {
        fun readLn() = readLine()!!
        fun readInt() = readLn().toInt()
        private fun readStrings() = readLn().split(" ")
        fun readCharAndInt(): Pair<Int, Char> {
            val (int, char) = readStrings()
            return Pair(int.toInt(), char[0])
        }
    }
}

fun solveProblem(name: String, k: Int, deletes: List<Pair<Int, Char>>): String {
    val toTakeLetters = arrayListOf<Boolean>()
    val letterToTree = HashMap<Char, Treap>()

    for (i in 0 until k) {
        for (j in 0 until name.length) {
            toTakeLetters.add(true)
            val char = name[j]
            val key = i * name.length + j

            if (!letterToTree.containsKey(char)) {
                letterToTree[char] = Treap()
            }

            letterToTree[char]!!.put(key)
        }
    }

    for ((ind, char) in deletes) {
        val key = letterToTree[char]!!.delete(ind - 1)

        if (key >= 0) {
            toTakeLetters[key] = false
        }
    }

    val result = StringBuilder()

    for (i in 0 until k) {
        for (j in 0 until name.length) {
            val char = name[j]
            val key = i * name.length + j

            if (toTakeLetters[key]) {
               result.append(char)
            }
        }
    }

    return result.toString()
}

fun main() {
    val k = CompetitiveIO.readInt()
    val name = CompetitiveIO.readLn()

    val n = CompetitiveIO.readInt()
    val deletes = LinkedList<Pair<Int, Char>>()

    for (i in 0 until n) {
        deletes.add(CompetitiveIO.readCharAndInt())
    }

    print(solveProblem(name, k, deletes))
}


//package ru.hse.spb

import java.util.*
import kotlin.collections.HashMap
import kotlin.random.Random

class TreapNode(private val key: Int) {
    private val priority: Long = Random.nextLong()
    private var leftChild: TreapNode? = null
    private var rightChild: TreapNode? = null
    var subtreeSize: Int = 1

    companion object {
        fun merge(left: TreapNode?, right: TreapNode?): TreapNode? {
            if (left == null) {
                return right
            }

            if (right == null) {
                return left
            }

            return if (left.priority > right.priority) {
                val merged = merge(left.rightChild, right)
                left.rightChild = merged
                left.updateSize()
                left
            } else {
                val merged = merge(left, right.leftChild)
                right.leftChild = merged
                right.updateSize()
                right
            }
        }
    }

    private fun updateSize() {
        val leftSize = if (leftChild == null) 0 else leftChild!!.subtreeSize
        val rightSize = if (rightChild == null) 0 else rightChild!!.subtreeSize

        subtreeSize = 1 + leftSize + rightSize
    }

    fun put(position: Int, newKey: Int): TreapNode {
        val (left, right) = split(position + 1)
        val newEntry = TreapNode(newKey)
        val leftMerged = merge(left, newEntry)
        val res = merge(leftMerged, right)
        res!!.updateSize()
        return res
    }

    fun get(getKey: Int) : Int {
        val (_, right) = split(getKey)
        return right?.split(1)?.first?.key ?: -1
    }

    fun delete(delKey: Int) : Pair<TreapNode?, Int> {
        val (left, right) = split(delKey)
        val (toDelete, finalRight) = right?.split(1) ?: Pair(null, null)
        return Pair(merge(left, finalRight), toDelete?.key ?: -1)
    }

    private fun split(splitKey: Int, add: Int = 0):  Pair<TreapNode?, TreapNode?> {
        val currentKey = add + if (leftChild == null) 0 else leftChild!!.subtreeSize

        if (splitKey <= currentKey) {
            if (leftChild == null) {
                return Pair(null, this)
            }

            val (left, right) = leftChild!!.split(splitKey, add)
            val retNode = TreapNode(key)
            retNode.leftChild = right
            retNode.rightChild = rightChild

            retNode.updateSize()

            return Pair(left, retNode)
        } else {
            if (rightChild == null) {
                return Pair(this, null)
            }

            val (left, right) = rightChild!!.split(splitKey, add + 1 +
                    if (leftChild == null) 0 else leftChild!!.subtreeSize)
            val retNode = TreapNode(key)
            retNode.leftChild = leftChild
            retNode.rightChild = left

            retNode.updateSize()

            return Pair(retNode, right)
        }
    }
}

class CompetitiveIO {
    companion object {
        fun readLn() = readLine()!!
        fun readInt() = readLn().toInt()
        private fun readStrings() = readLn().split(" ")
        fun readCharAndInt(): Pair<Int, Char> {
            val (int, char) = readStrings()
            return Pair(int.toInt(), char[0])
        }
    }
}

fun solveProblem(name: String, k: Int, deletes: List<Pair<Int, Char>>): String {
    val toTakeLetters = arrayListOf<Boolean>()
    val letterToTree = HashMap<Char, TreapNode?>()

    for (i in 0 until k) {
        for (j in 0 until name.length) {
            toTakeLetters.add(true)
            val char = name[j]
            val key = i * name.length + j
            if (letterToTree.containsKey(char)) {
                letterToTree[char] = letterToTree[char]!!.put(letterToTree[char]!!.subtreeSize, key)
            } else {
                letterToTree[char] = TreapNode(key)
            }
        }
    }

    for ((ind, char) in deletes) {
        val (afterDel, key) = letterToTree[char]!!.delete(ind - 1)
        letterToTree[char] = afterDel

        if (key >= 0) {
            toTakeLetters[key] = false
        }
    }

    val result = StringBuilder()

    for (i in 0 until k) {
        for (j in 0 until name.length) {
            val char = name[j]
            val key = i * name.length + j

            if (toTakeLetters[key]) {
               result.append(char)
            }
        }
    }

    return result.toString()
}

fun main() {
    val k = CompetitiveIO.readInt()
    val name = CompetitiveIO.readLn()

    val n = CompetitiveIO.readInt()
    val deletes = LinkedList<Pair<Int, Char>>()

    for (i in 0 until n) {
        deletes.add(CompetitiveIO.readCharAndInt())
    }

    print(solveProblem(name, k, deletes))
}


// submission: http://codeforces.com/contest/159/submission/60164638

//package ru.hse.spb

import java.util.*
import kotlin.collections.HashMap
import kotlin.random.Random

class Treap {
    private var root: TreapNode? = null
    private var rightmostNode: TreapNode? = null

    fun put(newKey: Int) {
        val newNode = TreapNode(newKey, null)

        if (root == null) {
            root = newNode
            rightmostNode = root
            return
        }

        when {
            root!!.priority <= newNode.priority -> {
                newNode.leftChild = root
                root = newNode
                rightmostNode = root
            }
            rightmostNode!!.priority >= newNode.priority -> {
                rightmostNode!!.rightChild = newNode
                rightmostNode = newNode
            }
            else -> {
                var curNode = rightmostNode
                while (curNode!!.priority < newNode.priority) {
                    curNode = curNode.parent
                }

                newNode.leftChild = curNode.rightChild
                curNode.rightChild = newNode

                rightmostNode = newNode
            }
        }

        var curNode: TreapNode? = newNode
        while (curNode != root) {
            curNode?.updateSize()
            curNode = curNode!!.parent
        }

        curNode?.updateSize()
    }

    fun delete(delKey: Int): Int {
        val (left, right) = root!!.split(delKey)
        val (toDelete, finalRight) = right?.split(1) ?: Pair(null, null)

        root = TreapNode.merge(left, finalRight)

        var curNode = root

        while (curNode?.rightChild != null) {
            curNode = curNode.rightChild
        }

        rightmostNode = curNode
        return toDelete?.key ?: -1
    }

    fun get(getKey: Int): Int {
        val (left, right) = root!!.split(getKey)
        val (res, rightmost) = right!!.split(1)
        root = TreapNode.merge(left, TreapNode.merge(res, rightmost))

        return res!!.key
    }

    class TreapNode(internal val key: Int, internal var parent: TreapNode? = null) {
        internal val priority: Long = Random.nextLong()

        var leftChild: TreapNode? = null
            set(value) {
                field = value
                value?.parent = this
            }
        var rightChild: TreapNode? = null
            set(value) {
                field = value
                value?.parent = this
            }
        private var subtreeSize: Int = 1

        companion object {
            fun merge(left: TreapNode?, right: TreapNode?): TreapNode? {
                if (left == null) {
                    right?.parent = null
                    return right
                }

                if (right == null) {
                    left.parent = null
                    return left
                }

                return if (left.priority > right.priority) {
                    val merged = merge(left.rightChild, right)
                    left.rightChild = merged
                    left.parent = null
                    left.updateSize()
                    left
                } else {
                    val merged = merge(left, right.leftChild)
                    right.leftChild = merged
                    right.parent = null
                    right.updateSize()
                    right
                }
            }
        }

        internal fun updateSize() {
            val leftSize = if (leftChild == null) 0 else leftChild!!.subtreeSize
            val rightSize = if (rightChild == null) 0 else rightChild!!.subtreeSize

            subtreeSize = 1 + leftSize + rightSize
        }

        internal fun split(splitKey: Int, add: Int = 0): Pair<TreapNode?, TreapNode?> {
            val currentKey = add + if (leftChild == null) 0 else leftChild!!.subtreeSize
            val resNode = this

            if (splitKey <= currentKey) {
                if (leftChild == null) {
                    this.parent = null
                    return Pair(null, this)
                }

                val (left, right) = leftChild!!.split(splitKey, add)

                resNode.leftChild = right
                resNode.rightChild = rightChild

                resNode.updateSize()

                left?.parent = null
                return Pair(left, resNode)
            } else {
                if (rightChild == null) {
                    this.parent = null
                    return Pair(this, null)
                }

                val (left, right) = rightChild!!.split(splitKey, add + 1 +
                        if (leftChild == null) 0 else leftChild!!.subtreeSize)

                resNode.leftChild = leftChild
                resNode.rightChild = left

                resNode.updateSize()

                right?.parent = null
                return Pair(resNode, right)
            }
        }
    }
}

class CompetitiveIO {
    companion object {
        fun readLn() = readLine()!!
        fun readInt() = readLn().toInt()
        private fun readStrings() = readLn().split(" ")
        fun readCharAndInt(): Pair<Int, Char> {
            val (int, char) = readStrings()
            return Pair(int.toInt(), char[0])
        }
    }
}

fun solveProblem(name: String, k: Int, deletes: List<Pair<Int, Char>>): String {
    val toTakeLetters = arrayListOf<Boolean>()
    val letterToTree = HashMap<Char, Treap>()

    for (i in 0 until k) {
        for (j in 0 until name.length) {
            toTakeLetters.add(true)
            val char = name[j]
            val key = i * name.length + j

            if (!letterToTree.containsKey(char)) {
                letterToTree[char] = Treap()
            }

            letterToTree[char]!!.put(key)
        }
    }

    for ((ind, char) in deletes) {
        val key = letterToTree[char]!!.delete(ind - 1)

        if (key >= 0) {
            toTakeLetters[key] = false
        }
    }

    val result = StringBuilder()

    for (i in 0 until k) {
        for (j in 0 until name.length) {
            val char = name[j]
            val key = i * name.length + j

            if (toTakeLetters[key]) {
               result.append(char)
            }
        }
    }

    return result.toString()
}

fun main() {
    val k = CompetitiveIO.readInt()
    val name = CompetitiveIO.readLn()

    val n = CompetitiveIO.readInt()
    val deletes = LinkedList<Pair<Int, Char>>()

    for (i in 0 until n) {
        deletes.add(CompetitiveIO.readCharAndInt())
    }

    print(solveProblem(name, k, deletes))
}


import java.io.File
import java.util.*

data class Change(val letter: Char, val index: Int)

class Solver(k: Int, s: String, private val changes: List<Change>) {

    private var blocks: Array<Block> = Array(k) { _ -> Block(s)}

    fun solve() {
        for (change in changes) {
            for (block in blocks) {
                print(block)
            }
            println()
            applyChange(change)
        }
        for (block in blocks) {
            print(block)
        }
    }

    private fun applyChange(change: Change) {
        val letterNumber = change.letter - 'a'
        val index = change.index
        var currentSkip = 0
        var currentBlock = 0
        while (currentSkip + blocks[currentBlock].getLetterCount(letterNumber) < index) {
            currentSkip += blocks[currentBlock].getLetterCount(letterNumber)
            currentBlock++
        }

        blocks[currentBlock].removeLetter(letterNumber, index - currentSkip)
    }
}

class Block(s: String) {

    private val letters : Array<Array<Boolean>> = Array(s.length) { _ -> Array(26) { _ -> false} }
    private val letterCounts : Array<Int> = Array(26) {_ -> 0}
    private val length : Int = s.length

    init {
        for ((i, c) in s.withIndex()) {
            val letterNum = c - 'a'
            letters[i][letterNum] = true
            letterCounts[letterNum]++
        }
    }

    fun getLetterCount(letter : Int) : Int {
        return letterCounts[letter]
    }

    fun removeLetter(letterNumber: Int, index: Int) {
        var currentSkip = 0
        for (i in 0 until length) {
            if (letters[i][letterNumber]) {
                if (currentSkip + 1 == index) {
                    letters[i][letterNumber] = false
                    letterCounts[letterNumber]--
                    break
                } else {
                    currentSkip++
                }
            }
        }
    }

    override fun toString(): String {
        val sb = StringBuilder()
        for (i in 0 until length) {
            for (c in 0 until  26) {
                if (letters[i][c]) {
                    sb.append((c + 'a'.toInt()).toChar())
                }
            }
        }
        return sb.toString()
    }
}

fun main(args: Array<String>) {
    with(Scanner(System.`in`)) {
        val k = nextLine().toInt()
        val s = nextLine()
        val q = nextLine().toInt()
        val changes = ArrayList<Change>()
        for (i in 0 until q) {
            val query = nextLine().split(' ')
            changes.add(Change(query[1][0], query[0].toInt()))
        }

        val solver = Solver(k, s, changes)
        solver.solve()
    }
}


import java.io.File
import java.util.*

data class Change(val letter: Char, val index: Int)

class Solver(k: Int, s: String, private val changes: List<Change>) {

    private var blocks: Array<Block> = Array(k) { _ -> Block(s)}

    fun solve() {
        for (change in changes) {
            applyChange(change)
        }
        for (block in blocks) {
            print(block)
        }
    }

    private fun applyChange(change: Change) {
        val letterNumber = change.letter - 'a'
        val index = change.index
        var currentSkip = 0
        var currentBlock = 0
        while (currentSkip + blocks[currentBlock].getLetterCount(letterNumber) < index) {
            currentBlock++
            currentSkip += blocks[currentBlock].getLetterCount(letterNumber)
        }

        blocks[currentBlock].removeLetter(letterNumber, index - currentSkip)
    }
}

class Block(s: String) {

    private val letters : Array<Array<Boolean>> = Array(s.length) { _ -> Array(26) { _ -> false} }
    private val letterCounts : Array<Int> = Array(26) {_ -> 0}
    private val length : Int = s.length

    init {
        for ((i, c) in s.withIndex()) {
            val letterNum = c - 'a'
            letters[i][letterNum] = true
            letterCounts[letterNum]++
        }
    }

    fun getLetterCount(letter : Int) : Int {
        return letterCounts[letter]
    }

    fun removeLetter(letterNumber: Int, index: Int) {
        var currentSkip = 0
        for (i in 0 until length) {
            if (letters[i][letterNumber]) {
                if (currentSkip + 1 == index) {
                    letters[i][letterNumber] = false
                    letterCounts[letterNumber]--
                    break
                } else {
                    currentSkip++
                }
            }
        }
    }

    override fun toString(): String {
        val sb = StringBuilder()
        for (i in 0 until length) {
            for (c in 0 until  26) {
                if (letters[i][c]) {
                    sb.append((c + 'a'.toInt()).toChar())
                }
            }
        }
        return sb.toString()
    }
}

fun main(args: Array<String>) {
    with(Scanner(System.`in`)) {
        val k = nextLine().toInt()
        val s = nextLine()
        val q = nextLine().toInt()
        val changes = ArrayList<Change>()
        for (i in 0 until q) {
            val query = nextLine().split(' ')
            changes.add(Change(query[1][0], query[0].toInt()))
        }

        val solver = Solver(k, s, changes)
        solver.solve()
    }
}


import java.io.File
import java.util.*

data class Change(val letter: Char, val index: Int)

class Solver(k: Int, s: String, private val changes: List<Change>) {

    private var blocks: Array<Block> = Array(k) { _ -> Block(s)}

    fun solve() {
        for (change in changes) {
            applyChange(change)
        }
        for (block in blocks) {
            print(block)
        }
    }

    private fun applyChange(change: Change) {
        val letterNumber = change.letter - 'a'
        val index = change.index
        var currentSkip = 0
        var currentBlock = 0
        while (currentSkip + blocks[currentBlock].getLetterCount(letterNumber) < index) {
            currentBlock++
            currentSkip += blocks[currentBlock].getLetterCount(letterNumber)
        }

        blocks[currentBlock].removeLetter(letterNumber, index - currentSkip)
    }
}

class Block(s: String) {

    private val letters : Array<Array<Boolean>> = Array(s.length) { _ -> Array(26) { _ -> false} }
    private val letterCounts : Array<Int> = Array(26) {_ -> 0}
    private val length : Int = s.length

    init {
        for ((i, c) in s.withIndex()) {
            val letterNum = c - 'a'
            letters[i][letterNum] = true
            letterCounts[letterNum]++
        }
    }

    fun getLetterCount(letter : Int) : Int {
        return letterCounts[letter]
    }

    fun removeLetter(letterNumber: Int, index: Int) {
        var currentSkip = 0
        for (i in 0 until length) {
            if (letters[i][letterNumber]) {
                if (currentSkip + 1 == index) {
                    letters[i][letterNumber] = false
                    letterCounts[letterNumber]--
                    break
                } else {
                    currentSkip++
                }
            }
        }
    }

    override fun toString(): String {
        val sb = StringBuilder()
        for (i in 0 until length) {
            for (c in 0 until  26) {
                if (letters[i][c]) {
                    sb.append((c + 'a'.toInt()).toChar())
                }
            }
        }
        return sb.toString()
    }
}

fun main(args: Array<String>) {
    with(Scanner(File("input.in"))) {
        val k = nextLine().toInt()
        val s = nextLine()
        val q = nextLine().toInt()
        val changes = ArrayList<Change>()
        for (i in 0 until q) {
            val query = nextLine().split(' ')
            changes.add(Change(query[1][0], query[0].toInt()))
        }

        val solver = Solver(k, s, changes)
        solver.solve()
    }
}


import java.io.File
import java.util.*

data class Change(val letter: Char, val index: Int)

class Solver(k: Int, s: String, private val changes: List<Change>) {

    private var blocks: Array<Block> = Array(k) { _ -> Block(s)}

    fun solve() {
        for (change in changes) {
            applyChange(change)
        }
    }

    fun printSolution() {
        for (block in blocks) {
            print(block)
        }
    }

    private fun applyChange(change: Change) {
        val letterNumber = change.letter - 'a'
        val index = change.index
        var currentSkip = 0
        var currentBlock = 0
        while (currentSkip + blocks[currentBlock].getLetterCount(letterNumber) < index) {
            currentSkip += blocks[currentBlock].getLetterCount(letterNumber)
            currentBlock++
        }

        blocks[currentBlock].removeLetter(letterNumber, index - currentSkip)
    }
}

class Block(s: String) {

    private val letters : Array<Array<Boolean>> = Array(s.length) { _ -> Array(26) { _ -> false} }
    private val letterCounts : Array<Int> = Array(26) {_ -> 0}
    private val length : Int = s.length

    init {
        for ((i, c) in s.withIndex()) {
            val letterNum = c - 'a'
            letters[i][letterNum] = true
            letterCounts[letterNum]++
        }
    }

    fun getLetterCount(letter : Int) : Int {
        return letterCounts[letter]
    }

    fun removeLetter(letterNumber: Int, index: Int) {
        var currentSkip = 0
        for (i in 0 until length) {
            if (letters[i][letterNumber]) {
                if (currentSkip + 1 == index) {
                    letters[i][letterNumber] = false
                    letterCounts[letterNumber]--
                    break
                } else {
                    currentSkip++
                }
            }
        }
    }

    override fun toString(): String {
        val sb = StringBuilder()
        for (i in 0 until length) {
            for (c in 0 until  26) {
                if (letters[i][c]) {
                    sb.append((c + 'a'.toInt()).toChar())
                }
            }
        }
        return sb.toString()
    }
}

fun main(args: Array<String>) {
    with(Scanner(System.`in`)) {
        val k = nextLine().toInt()
        val s = nextLine()
        val q = nextLine().toInt()
        val changes = ArrayList<Change>()
        for (i in 0 until q) {
            val query = nextLine().split(' ')
            changes.add(Change(query[1][0], query[0].toInt()))
        }

        val solver = Solver(k, s, changes)
        solver.solve()
        solver.printSolution()
    }
}


class Fenwick(private val size: Int) {
    private val arr: Array<Int> = Array(size, {0})

    fun add(pos: Int, value: Int) {
        var i = pos
        while (i < size) {
            arr[i] += value
            i = i or i + 1
        }
    }

    fun getSum(to: Int): Int {
        var sum = 0
        var r = to
        while (r >= 0) {
            sum += arr[r]
            r = (r and r + 1) - 1
        }
        return sum
    }
}

class Nickname(private val originalNickname: String) {
    companion object {
        private val ALPHABET_SIZE: Int = 26
    }

    private val deletedLetters: Array<Boolean> = Array(originalNickname.length, {false})
    private val letterCount: Array<Fenwick> = Array(ALPHABET_SIZE, {Fenwick(originalNickname.length)})

    init {
        for (i in 0 until originalNickname.length) {
            letterCount[originalNickname[i].alphabetPos()].add(i, 1)
        }
    }

    private fun Char.alphabetPos(): Int = this - 'a'

    fun get(): String {
        val currentNickname = StringBuilder()
        for (i in 0 until originalNickname.length) {
            if (!deletedLetters[i]) {
                currentNickname.append(originalNickname[i])
            }
        }
        return currentNickname.toString()
    }

    fun deleteNthLetter(n: Int, letter: Char) {
        var left = -1
        var right = originalNickname.length - 1
        val thisLetterCount = letterCount[letter.alphabetPos()]
        while (left < right - 1) {
            val mid = (left + right) / 2
            if (thisLetterCount.getSum(mid) >= n) right = mid
            else left = mid
        }
        deletedLetters[right] = true
        thisLetterCount.add(right, -1)
    }
}

fun main(args: Array<String>) {
    val repeatCount = readLine()!!.toInt()
    val nicknamePart = readLine()
    val modificationCount = readLine()!!.toInt()
    val nickname = Nickname(nicknamePart!!.repeat(repeatCount))
    for (i in 0 until modificationCount) {
        val (pos, letter) = readLine()!!.split(' ')
        nickname.deleteNthLetter(pos.toInt(), letter[0])
    }
    print(nickname.get())
}


package ru.spbau.mit

class Fenwick(private val size: Int) {
    private val arr: Array<Int> = Array(size, {i -> 0})

    fun add(pos: Int, value: Int) {
        var i = pos
        while (i < size) {
            arr[i] += value
            i = i or i + 1
        }
    }

    fun getSum(to: Int): Int {
        var sum = 0
        var r = to
        while (r >= 0) {
            sum += arr[r]
            r = (r and r + 1) - 1
        }
        return sum
    }
}

class Nickname(private val originalNickname: String) {
    companion object {
        private val ALPHABET_SIZE: Int = 26
    }

    private val deletedLetters: Array<Boolean> = Array(originalNickname.length, {i -> false})
    private val letterCount: Array<Fenwick> = Array(ALPHABET_SIZE, { i -> Fenwick(originalNickname.length)})

    init {
        for (i in 0 until originalNickname.length) {
            letterCount[originalNickname[i].alphabetPos()].add(i, 1)
        }
    }

    private fun Char.alphabetPos(): Int = this - 'a'

    fun get(): String {
        val currentNickname = StringBuilder()
        for (i in 0 until originalNickname.length) {
            if (!deletedLetters[i]) {
                currentNickname.append(originalNickname[i])
            }
        }
        return currentNickname.toString()
    }

    fun deleteNthLetter(n: Int, letter: Char) {
        var left = -1
        var right = originalNickname.length - 1
        val thisLetterCount = letterCount[letter.alphabetPos()]
        while (left < right - 1) {
            val mid = (left + right) / 2
            if (thisLetterCount.getSum(mid) >= n) right = mid
            else left = mid
        }
        deletedLetters[right] = true
        thisLetterCount.add(right, -1)
    }
}

fun main(args: Array<String>) {
    val repeatCount = readLine()!!.toInt()
    val nicknamePart = readLine()
    val modificationCount = readLine()!!.toInt()
    val nickname = Nickname(nicknamePart!!.repeat(repeatCount))
    for (i in 0 until modificationCount) {
        val (pos, letter) = readLine()!!.split(' ')
        nickname.deleteNthLetter(pos.toInt(), letter[0])
    }
    print(nickname.get())
}


package ru.spbau.mit

class Fenwick(private val size: Int) {
    private val arr: Array<Int> = Array(size, {0})

    fun add(pos: Int, value: Int) {
        var i = pos
        while (i < size) {
            arr[i] += value
            i = i or i + 1
        }
    }

    fun getSum(to: Int): Int {
        var sum = 0
        var r = to
        while (r >= 0) {
            sum += arr[r]
            r = (r and r + 1) - 1
        }
        return sum
    }
}

class Nickname(private val originalNickname: String) {
    companion object {
        private val ALPHABET_SIZE: Int = 26
    }

    private val deletedLetters: Array<Boolean> = Array(originalNickname.length, {false})
    private val letterCount: Array<Fenwick> = Array(ALPHABET_SIZE, {Fenwick(originalNickname.length)})

    init {
        for (i in 0 until originalNickname.length) {
            letterCount[originalNickname[i].alphabetPos()].add(i, 1)
        }
    }

    private fun Char.alphabetPos(): Int = this - 'a'

    fun get(): String {
        val currentNickname = StringBuilder()
        for (i in 0 until originalNickname.length) {
            if (!deletedLetters[i]) {
                currentNickname.append(originalNickname[i])
            }
        }
        return currentNickname.toString()
    }

    fun deleteNthLetter(n: Int, letter: Char) {
        var left = -1
        var right = originalNickname.length - 1
        val thisLetterCount = letterCount[letter.alphabetPos()]
        while (left < right - 1) {
            val mid = (left + right) / 2
            if (thisLetterCount.getSum(mid) >= n) right = mid
            else left = mid
        }
        deletedLetters[right] = true
        thisLetterCount.add(right, -1)
    }
}

fun main(args: Array<String>) {
    val repeatCount = readLine()!!.toInt()
    val nicknamePart = readLine()
    val modificationCount = readLine()!!.toInt()
    val nickname = Nickname(nicknamePart!!.repeat(repeatCount))
    for (i in 0 until modificationCount) {
        val (pos, letter) = readLine()!!.split(' ')
        nickname.deleteNthLetter(pos.toInt(), letter[0])
    }
    print(nickname.get())
}


//package ru.hse.spb

import kotlin.random.Random

private fun read() = readLine()!!
private fun readInt() = read().toInt()
private fun readStrings() = read().split(' ')

data class TreapNode(val value: Int, val priority: Int = Random.nextInt()) {
    var left: TreapNode? = null
    var right: TreapNode? = null
    var size: Int = 1

    fun update(): TreapNode {
        size = 1 + left.size + right.size
        return this
    }
}

val TreapNode?.size: Int
    get() = this?.size ?: 0

fun TreapNode?.split(position: Int): Pair<TreapNode?, TreapNode?> = when {
    this == null -> null to null
    left.size < position -> {
        val (less, greater) = right.split(position - left.size - 1)
        right = less
        this.update() to greater
    }
    else -> {
        val (less, greater) = left.split(position)
        left = greater
        less to this.update()
    }
}

fun merge(node1: TreapNode?, node2: TreapNode?): TreapNode? = when {
    node1 == null || node2 == null -> node1 ?: node2
    node1.priority > node2.priority -> {
        node1.right = merge(node1.right, node2)
        node1.update()
    }
    else -> {
        node2.left = merge(node1, node2.left)
        node2.update()
    }
}

class Treap {
    private var root: TreapNode? = null

    fun insert(value: Int) {
        root = merge(root, TreapNode(value))
    }

    fun remove(position: Int): Int? {
        val (left, other) = root.split(position)
        val (removed, right) = other.split(position - left.size + 1)
        root = merge(left, right)
        return removed?.value
    }
}

fun main() {
    val k = readInt()
    val s = read()
    val n = readInt()

    val lettersWithPositions = HashMap<Char, Treap>()
    s.repeat(k).asSequence().forEachIndexed { index, char ->
        lettersWithPositions.getOrPut(char, ::Treap).insert(index)
    }

    val removedLettersPositions = HashSet<Int>()
    for (iterator in 1..n) {
        val (position, char) = readStrings().zipWithNext { p, c -> p.toInt() to c.first() }.first()
        lettersWithPositions[char]?.remove(position - 1)?.let { removedLettersPositions.add(it) }
    }

    s.repeat(k).asSequence().filterIndexed { index, _ -> index !in removedLettersPositions }.forEach(::print)
    println()
}


package ru.hse.spb

import kotlin.random.Random

private fun read() = readLine()!!
private fun readInt() = read().toInt()
private fun readStrings() = read().split(' ')

data class TreapNode(val value: Int, val priority: Int = Random.nextInt()) {
    var left: TreapNode? = null
    var right: TreapNode? = null
    var size: Int = 1

    fun update(): TreapNode {
        size = 1 + left.size + right.size
        return this
    }
}

val TreapNode?.size: Int
    get() = this?.size ?: 0

fun TreapNode?.split(position: Int): Pair<TreapNode?, TreapNode?> = when {
    this == null -> null to null
    left.size < position -> {
        val (less, greater) = right.split(position - left.size - 1)
        right = less
        this.update() to greater
    }
    else -> {
        val (less, greater) = left.split(position)
        left = greater
        less to this.update()
    }
}

fun merge(node1: TreapNode?, node2: TreapNode?): TreapNode? = when {
    node1 == null || node2 == null -> node1 ?: node2
    node1.priority > node2.priority -> {
        node1.right = merge(node1.right, node2)
        node1.update()
    }
    else -> {
        node2.left = merge(node1, node2.left)
        node2.update()
    }
}

class Treap {
    private var root: TreapNode? = null

    fun insert(value: Int) {
        root = merge(root, TreapNode(value))
    }

    fun remove(position: Int): Int? {
        val (left, other) = root.split(position)
        val (removed, right) = other.split(position - left.size + 1)
        root = merge(left, right)
        return removed?.value
    }
}

fun main() {
    val k = readInt()
    val s = read()
    val n = readInt()

    val lettersWithPositions = HashMap<Char, Treap>()
    s.repeat(k).asSequence().forEachIndexed { index, char ->
        lettersWithPositions.getOrPut(char, ::Treap).insert(index)
    }

    val removedLettersPositions = HashSet<Int>()
    for (iterator in 1..n) {
        val (position, char) = readStrings().zipWithNext { p, c -> p.toInt() to c.first() }.first()
        lettersWithPositions[char]?.remove(position - 1)?.let { removedLettersPositions.add(it) }
    }

    s.repeat(k).asSequence().filterIndexed { index, _ -> index !in removedLettersPositions }.forEach(::print)
    println()
}


#include <cmath>
#include <algorithm>
#include <bitset>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <vector>
using namespace std;

struct Bit {
    int  _n;
    int* _c;
    int  _d;

    Bit() {
    }
    Bit(int n) {
        _n = n;
        _c = (int*) calloc(n + 1, sizeof(int));
        _d = 1 << (31 - __builtin_clz(n));
    }
    ~Bit() {
        free(_c);
    }
    void modi(int p, int d) {
        for (; p <= _n; p += p & -p) _c[p] += d;
    }
    int sum(int p) const {
        int s = 0;
        for (; p > 0; p -= p & -p) s += _c[p];
        return s;
    }
    int operator [](int id) const {
        int p = 0;
        int s = 0;
        for (int i = _d; i > 0; i >>= 1) {
            if (p + i < _n && s + _c[p + i] <= id) {
                p += i;
                s += _c[p];
            }
        }
        return p + 1;
    }
};

int main() {
    int k;
    static char s[2000 * 100 + 10];
    scanf("%d", &k);
    scanf("%s", s);
    int n = strlen(s);
    for (int i = 0; i < k; i++) {
        memcpy(s + n * i, s, n);
    }
    //printf("%s\n", s);

    n *= k;
    Bit* bit[26];
    for (int i = 0; i < 26; i++) {
        bit[i] = new Bit(n);
    }
    for (int i = 0; i < n; i++) {
        bit[s[i] - 'a']->modi(i + 1, 1);
    }

    int m;
    scanf("%d", &m);
    for (int i = 0; i < m; i++) {
        int t;
        char c;
        scanf("%d %c", &t, &c);
        //cout << c << endl;
        bit[c - 'a']->modi((*bit[c - 'a'])[t - 1], -1);
    }

    vector<pair<int, char> > ans;
    for (int i = 0; i < 26; i++) {
        int tot = bit[i]->sum(n);
        for (int j = 0; j < tot; j++) {
            ans.push_back(make_pair((*bit[i])[j], 'a' + i));
        }
    }
    sort(ans.begin(), ans.end());
    for (int i = 0; i < ans.size(); i++) {
        putchar(ans[i].second);
    }
    return 0;
}


#include <cmath>
#include <algorithm>
#include <bitset>
#include <functional>
#include <iomanip>
#include <iostream>
#include <cstring>
#include <map>
#include <numeric>
#include <vector>
using namespace std;

struct Bit {
    int  _n;
    int* _c;
    int  _d;

    Bit() {
    }
    Bit(int n) {
        _n = n;
        _c = (int*) calloc(n + 1, sizeof(int));
        _d = 1 << (31 - __builtin_clz(n));
    }
    ~Bit() {
        free(_c);
    }
    void modi(int p, int d) {
        for (; p <= _n; p += p & -p) _c[p] += d;
    }
    int sum(int p) const {
        int s = 0;
        for (; p > 0; p -= p & -p) s += _c[p];
        return s;
    }
    int operator [](int id) const {
        int p = 0;
        int s = 0;
        for (int i = _d; i > 0; i >>= 1) {
            if (p + i < _n && s + _c[p + i] <= id) {
                p += i;
                s += _c[p];
            }
        }
        return p + 1;
    }
};

int main() {
    int k;
    static char s[2000 * 100 + 10];
    scanf("%d", &k);
    scanf("%s", s);
    int n = strlen(s);
    for (int i = 0; i < k; i++) {
        memcpy(s + n * i, s, n);
    }
    //printf("%s\n", s);

    n *= k;
    Bit* bit[26];
    for (int i = 0; i < 26; i++) {
        bit[i] = new Bit(n);
    }
    for (int i = 0; i < n; i++) {
        bit[s[i] - 'a']->modi(i + 1, 1);
    }

    int m;
    scanf("%d", &m);
    for (int i = 0; i < m; i++) {
        int t;
        char c;
        scanf("%d %c", &t, &c);
        //cout << c << endl;
        bit[c - 'a']->modi((*bit[c - 'a'])[t - 1], -1);
    }

    vector<pair<int, char> > ans;
    for (int i = 0; i < 26; i++) {
        int tot = bit[i]->sum(n);
        for (int j = 0; j < tot; j++) {
            ans.push_back(make_pair((*bit[i])[j], 'a' + i));
        }
    }
    sort(ans.begin(), ans.end());
    for (int i = 0; i < ans.size(); i++) {
        putchar(ans[i].second);
    }
    return 0;
}


/**/
#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define FOR(i, begin, end) for(__typeof(end) i = (begin); i < (end); i++)
#define For(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define all(v) v.begin(),v.end()
#define minv(v) min_element(all(v))
#define maxv(v) max_element(all(v))
#define V vector
typedef long long ll;
/***********************************************/
/* Dear online judge:
 * I've read the problem, and tried to solve it.
 * Even if you don't accept my solution, you should respect my effort.
 * I hope my code compile and get accepted. O.o
 *      ____________
 *     /         __ \
 *    /   __    |  | \
 *   /   |__|   |  |  \
 *  (           |__|   )
 *   \                /
 *    \      ___     /
 *     \____________/
 */
const ll mod = 100000007;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    string str;
    int rep,n,p;
    char c;
    cin>>rep>>str;
    V<int> pos[26] = {V<int>(0)};
    For(j,0,rep){
        For(i,0,str.size()){
            pos[str[i] - 'a'].pb(i+str.size()*j);
        }
    }
    cin>>n;
    while(n--){
        cin>>p>>c;
        pos[c-'a'].erase(next(pos[c-'a'].begin(),p-1));
    }
    str = string(str.size()*rep,' ');
    For(i,0,26){
        For(j,0,pos[i].size()){
            str[pos[i][j]] = i+'a';
        }
    }
    For(i,0,str.size()){
        if(str[i]!=' ')
            cout<<str[i];
    }
    return 0;
}
/**/


/**/
#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define FOR(i, begin, end) for(__typeof(end) i = (begin); i < (end); i++)
#define For(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define all(v) v.begin(),v.end()
#define minv(v) min_element(all(v))
#define maxv(v) max_element(all(v))
#define V vector
typedef long long ll;
/***********************************************/
/* Dear online judge:
 * I've read the problem, and tried to solve it.
 * Even if you don't accept my solution, you should respect my effort.
 * I hope my code compile and get accepted. O.o
 *      ____________
 *     /         __ \
 *    /   __    |  | \
 *   /   |__|   |  |  \
 *  (           |__|   )
 *   \                /
 *    \      ___     /
 *     \____________/
 */
const ll mod = 100000007;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    string str;
    int rep,n,p;
    char c;
    cin>>rep>>str;
    list<int> pos[26] = {list<int>(0)};
    For(j,0,rep){
        For(i,0,str.size()){
            pos[str[i] - 'a'].pb(i+str.size()*j);
        }
    }
    cin>>n;
    while(n--){
        cin>>p>>c;
        pos[c-'a'].erase(next(pos[c-'a'].begin(),p-1));
    }
    str = string(str.size()*rep,' ');
    For(i,0,26){
        while(!pos[i].empty()){
            str[pos[i].front()] = i+'a';
            pos[i].pop_front();
        }
    }
    For(i,0,str.size()){
        if(str[i]!=' ')
            cout<<str[i];
    }
    return 0;
}
/**/


/**/
#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define FOR(i, begin, end) for(__typeof(end) i = (begin); i < (end); i++)
#define For(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define all(v) v.begin(),v.end()
#define minv(v) min_element(all(v))
#define maxv(v) max_element(all(v))
#define V vector
typedef long long ll;
/***********************************************/
/* Dear online judge:
 * I've read the problem, and tried to solve it.
 * Even if you don't accept my solution, you should respect my effort.
 * I hope my code compile and get accepted. O.o
 *      ____________
 *     /         __ \
 *    /   __    |  | \
 *   /   |__|   |  |  \
 *  (           |__|   )
 *   \                /
 *    \      ___     /
 *     \____________/
 */
const ll mod = 100000007;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    string str;
    int rep,n,p;
    char c;
    cin>>rep>>str;
    list<int> marked[26] = {list<int>(0)};
    For(i,0,str.size()){
        For(j,0,rep){
            marked[str[i] - 'a'].pb(i+str.size()*j);
        }
    }
    cin>>n;
    while(n--){
        cin>>p>>c;
        marked[c-'a'].erase(next(marked[c-'a'].begin(),p-1));
    }
    str = string(str.size()*rep,' ');
    For(i,0,26){
        while(!marked[i].empty()){
                str[marked[i].front()] = i+'a';
                marked[i].pop_front();
        }
    }
    For(i,0,str.size()){
        if(str[i]!=' ')
            cout<<str[i];
    }
    return 0;
}
/**/


#include <map>
#include <set>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <vector>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
#define MM(a,x) memset(a,x,sizeof(a));
#define ALL(x)  (x).begin(), (x).end()
#define P(x)	cerr<<"["#x<<" = "<<x<<"]\n"
#define PP(x,i)	cerr<<"["#x<<i<<" = "<<x[i]<<"]\n"
#define P2(x,y)	cerr<<"["#x" = "<<x<<", "#y" = "<<y<<"]\n"
#define TM(a,b)	cerr<<"["#a" -> "#b": "<<1e3*(b-a)/CLOCKS_PER_SEC<<"ms]\n";
#define FOR(it,v) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define mp make_pair
#define pb push_back
#define x first
#define y second
struct _ {_() {ios_base::sync_with_stdio(0);}} _;
template<class T> void PV(T a, T b) {while(a != b)cout << *a++, cout << (a != b ? " " : "\n");}
template<class T> inline bool chmin(T &a, T b) {return a > b ? a = b, 1 : 0;}
template<class T> inline bool chmax(T &a, T b) {return a < b ? a = b, 1 : 0;}
const int inf = 0x3f3f3f3f;
const int mod = int(1e9) + 7;

int n;
string s, ss;

VI g[26];
VI q[26];

bool v[200010];

int d[222222 * 4];

void add(int L, int R, int c, int l, int r, int rt) {
	if(L <= l && r <= R) {
		d[rt] += c;
		return;
	}
	int m = (l + r) / 2;
	if(L <= m) add(L, R, c, l, m, 2 * rt);
	if(R > m) add(L, R, c, m + 1, r, 2 * rt + 1);
	d[rt] = d[2 * rt] + d[2 * rt + 1];
}

void modify(int k, int l, int r, int rt) {
	assert(d[rt] >= k);
	if(l == r) {
		v[l] = 0;
		d[rt] = 0;
		return;
	}
	int m = (l + r) / 2;
	int t = d[2 * rt];
	if(t >= k) modify(k, l, m, 2 * rt);
	else modify(k - t, m + 1, r, 2 * rt + 1);
	d[rt] = d[2 * rt] + d[2 * rt + 1];
}

char res[222222];

int main() {
	cin >> n >> ss;
	for(int i = 0; i < n; i++) s += ss;
	n = s.length();
	for(int i = 0; i < n; i++) g[s[i] - 'a'].pb(i + 1);
	int Q;
	cin >> Q;
	while(Q--) {
		int p;
		char c;
		cin >> p >> c;
		q[c - 'a'].pb(p);
	}
	vector<PII> vp;
	for(int i = 0; i < 26; i++) {
		MM(d, 0);
		MM(v, 0);
		for(auto j : g[i]) {
			v[j] = 1;
			add(j, j, 1, 1, n, 1);
		}
		for(auto j : q[i]) modify(j, 1, n, 1);
		for(int j = 1; j <= n; j++) if(v[j]) res[j] = i + 'a';
	}
	for(int i = 1; i <= n; i++) if(res[i] > 0) cout << res[i];
	cout << endl;
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <list>
#include <cmath>
#include <iterator>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cctype>

using namespace std;

#define vi vector<int>
#define vvi vector <vi >
#define fi(n) for(int i=0;i<(n);++i)
#define fj(n) for(int j=0;j<(n);++j)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(a) (int)(a).size()
#define mp make_pair
#define pb push_back

void prepare()
{
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
}

void solve()
{
	ios_base::sync_with_stdio(0);
	int k;
	string s;
	cin>>k>>s;
	int z=s.size();
	string ans;
	ans.reserve(z*k);
	for (int i=0;i<k;++i)
		ans+=s;
	vector<int> used(26);
	vector<vector<int>> pos(26);
	for (int i=0; i<z; ++i)
		pos[s[i]-'a'].push_back(i);
	int n;
	cin>>n;
	int p;
	char ch;
	for (int i=0; i<n;++i)
	{
		cin>>p>>ch;
		--p;
		int c=ch-'a';
		int q=(p+used[c])/pos[c].size();
		ans[z*q+pos[c][(p+used[c])%pos[c].size()]]=0;
		++used[c];
	}
	for (int i=0;i<ans.size();++i)
	{
		if (ans[i]!=0)
			cout<<ans[i];
	}
	cout<<endl;
}

int main()
{
	prepare();
	solve();
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <list>
#include <cmath>
#include <iterator>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cctype>

using namespace std;

#define vi vector<int>
#define vvi vector <vi >
#define fi(n) for(int i=0;i<(n);++i)
#define fj(n) for(int j=0;j<(n);++j)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(a) (int)(a).size()
#define mp make_pair
#define pb push_back

void prepare()
{
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
}

void solve()
{
	ios_base::sync_with_stdio(0);
	int k;
	string s;
	cin>>k>>s;
	int z=s.size();
	string ans;
	ans.reserve(z*k);
	for (int i=0;i<k;++i)
		ans+=s;
	//vector<set<int>> used(26);
	vector<list<int>> used(26);
	vector<vector<int>> pos(26);
	for (int i=0; i<z; ++i)
		pos[s[i]-'a'].push_back(i);
	int n;
	cin>>n;
	int p;
	char ch;
	list<int>::iterator it;
	for (int i=0; i<n;++i)
	{
		//cerr<<i<<endl;
		cin>>p>>ch;
		--p;
		int c=ch-'a';
		int pp=0;
		it=used[c].begin();
		while (it!=used[c].end() && p+pp>=*it)
		{
			++pp;
			it++;
		}
		p+=pp;
		int q=p/pos[c].size();
		ans[z*q+pos[c][p%pos[c].size()]]='#';
		used[c].insert(it,p);
	}
	for (int i=0;i<ans.size();++i)
	{
		if (ans[i]!='#')
			cout<<ans[i];
	}
	cout<<endl;
}

void solve_()
{
	cout<<2000<<endl;
	for (int i=0;i<100;++i)
		cout<<'a';
	cout<<endl<<20000<<endl;
	for (int i=0;i<20000;++i)
		cout<<"1 a\n";
}

int main()
{
	prepare();
	solve();
	return 0;
}


#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<cstdio>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<cstdlib>
#include<list>
#include<set>
#include<map>
#include<climits>
#define ff(i,a,b) for (int i=a;i<b;i++)
#define ffd(i,a,b) for (int i=a;i>=b;i--)
#define f(i,n) ff(i,0,n)
#define In(i,a,b) (i>=a && i<=b)
#define offset 200
#define ll long long int
using namespace std;

int main(){
int k,n,p;
char c,tmp[110]="",linea[200010]="";
scanf("%d",&k);gets(tmp);gets(tmp);scanf("%d",&n);
int len=strlen(tmp);
int ind=0;
vector<int>frec[30];
int tam[30];
memset(tam,0,sizeof(tam));
f(i,k){
    f(j,len){
        linea[ind]=tmp[j];
        frec[tmp[j]-'a'].push_back(ind++);
    }
}
linea[ind]=0;

f(i,n){
    scanf("%d %c",&p,&c);
    linea[frec[c-'a'][p-1]]='*';
    frec[c-'a'].erase(frec[c-'a'].begin()+p-1);
}

f(i,ind){
    if (linea[i]!='*')putchar(linea[i]);

}
puts("");
return 0;}


#include<bits/stdc++.h>
using namespace std;

#define all(v) v.begin(),v.end()
#define V vector
#define S string
#define pb push_back
#define sz size()
typedef long long ll;
typedef unsigned long long ull;
int main(){
    cin.tie(0);
    std::ios::sync_with_stdio(false);
    int n; cin>>n;
    S s , mul=""; cin>>s;
    while(n--)mul+=s;
    V<int>alpha[24];
    for(int i=0;i<mul.sz;i++)alpha[mul[i]-'a'].pb(i);
    cin>>n;
    int x; char a;
    while(n--){
        cin>>x>>a;
        mul[alpha[x-'a'][a-1]]='#';
        alpha[x-'a'].erase(alpha[a-'a'].begin+a-1);
    }
    for(int i=0;i<mul.sz;i++)if(mul[i]!='#')cout<<mul[i];
}


#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
    int n; cin >> n;
    string s; cin >> s;
    string mul="";
    while (n--){
        mul += s;
    }
    vector<int> valpha[26];
    for (int i = 0; i < mul.size(); i++)valpha[mul[i] - 'a'].push_back(i);
    cin >> n;
    int x; char a;
    while (n--){
        cin >> x >> a;
        while (mul[valpha[a - 'a'][x - 1]] == '☻'){ x++; }
        mul[valpha[a - 'a'][x - 1]] = '☻';
    }
    for (int i = 0; i < mul.size(); i++)if (mul[i] != '☻')cout << mul[i];
    cout << "\n"; //:-p
}


#include<bits/stdc++.h>
using namespace std;

#define all(v) v.begin(),v.end()
#define V vector
#define S string
#define pb push_back
#define sz size()
typedef long long ll;
typedef unsigned long long ull;
int main(){
    cin.tie(0);
    std::ios::sync_with_stdio(false);
    int n; cin>>n;
    S s , mul=""; cin>>s;
    while(n--)mul+=s;
    V<int>alpha[24];
    for(int i=0;i<mul.sz;i++)alpha[mul[i]-'a'].pb(i);
    cin>>n;
    int x; char a;
    while(n--){
        cin>>x>>a;
        mul[alpha[x-'a'][a-1]]='#';
        alpha[x-'a'].erase(alpha[a-'a'].begin()+a-1);
    }
    for(int i=0;i<mul.sz;i++)if(mul[i]!='#')cout<<mul[i];
}


#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
    int n; cin >> n;
    string s; cin >> s;
    string mul="";
    while (n--){
        mul += s;
    }
    vector<int> valpha[26];
    for (int i = 0; i < mul.size(); i++)valpha[mul[i] - 'a'].push_back(i);
    cin >> n;
    int x; char a;
    while (n--){
        cin >> x >> a;
        while (mul[valpha[a - 'a'][x - 1]] == ':'&&x<valpha[a-'a'].size()){ x++; }
        mul[valpha[a - 'a'][x - 1]] = ':';
    }
    for (int i = 0; i < mul.size(); i++)if (mul[i] != ':')cout << mul[i];
    cout << "\n"; //:-p
}


#include<bits/stdc++.h>
using namespace std;

#define all(v) v.begin(),v.end()
#define V vector
#define S string
#define pb push_back
#define sz size()
typedef long long ll;
typedef unsigned long long ull;
int main(){
    cin.tie(0);
    std::ios::sync_with_stdio(false);
    int n; cin>>n;
    S s , mul=""; cin>>s;
    while(n--)mul+=s;
    V<int>alpha[26];
    for(int i=0;i<mul.sz;i++)alpha[mul[i]-'a'].pb(i);
    cin>>n;
    int x; char a;
    while(n--){
        cin>>x>>a;
        mul[alpha[a-'a'][x-1]]='#';
        alpha[a-'a'].erase(alpha[a-'a'].begin()+x-1);
    }
    for(int i=0;i<mul.sz;i++)if(mul[i]!='#')cout<<mul[i];
}


#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
    int n; cin >> n;
    string s; cin >> s;
    string mul="";
    while (n--){
        mul += s;
    }
    vector<int> valpha[26];
    for (int i = 0; i < mul.size(); i++)valpha[mul[i] - 'a'].push_back(i);
    cin >> n;
    int x; char a;
    while (n--){
        cin >> x >> a;
        while (mul[valpha[a - 'a'][x - 1]] == ':'){ x++; }
        mul[valpha[a - 'a'][x - 1]] = ':';
    }
    for (int i = 0; i < mul.size(); i++)if (mul[i] != ':')cout << mul[i];
    cout << "\n"; //:-p
}


#include<bits/stdc++.h>
using namespace std;

#define all(v) v.begin(),v.end()
#define V vector
#define S string
#define pb push_back
#define sz size()
typedef long long ll;
typedef unsigned long long ull;
int main(){
    cin.tie(0);
    std::ios::sync_with_stdio(false);
    int n; cin>>n;
    S s , mul=""; cin>>s;
    while(n--)mul+=s;
    V<int>alpha[24];
    for(int i=0;i<mul.sz;i)++)alpha[mul[i]-'a'].pb(i);
    cin>>n;
    int x; char a;
    while(n--){
        cin>>x>>a;
        mul[alpha[x-'a'][a-1]]='#';
        alpha[x-'a'].erase(alpha[a-'a'].begin+a-1);
    }
    for(int i=0;i<mul.sz;i++)if(mul[i]!='#')cout<<mul[i];
}


#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
    int n; cin >> n;
    string s; cin >> s;
    string mul="";
    while (n--){
        mul += s;
    }
    vector<int> valpha[26];
    for (int i = 0; i < mul.size(); i++)valpha[mul[i] - 'a'].push_back(i);
    cin >> n;
    int x; char a;
    while (n--){
        cin >> x >> a;
        while (mul[valpha[a - 'a'][x - 1]] == ':'&&x<valpha[a-'a'].size()-1){ x++; }
        mul[valpha[a - 'a'][x - 1]] = ':';
    }
    for (int i = 0; i < mul.size(); i++)if (mul[i] != ':')cout << mul[i];
    cout << "\n"; //:-p
}


//ITNOG
#include<bits/stdc++.h>

using namespace std;
#define int long long

const int maxN = 200*1000 + 5;
const int mod = 1000*1000*1000 + 7;
vector<int> a[30];
int fen[30][maxN];
int mark[30][maxN];
void set_(int t, int n, int k)
{
    for(; n < maxN; n += n & (-n))
	  fen[t][n] += k;
}
int get(int t, int n)
{
    int ans = 0;
    for(; n > 0; n -= n & (-n))
	  ans += fen[t][n];
    return ans;
}
int find_(int t, int p)
{
    int lo = 0, hi = maxN - 1;
    //cout << t << ' ' << p << endl;
    for(int i = 0; i < 20; i ++)
    {
	  int mid = (lo + hi) >> 1;
	  if(get(t, mid) >= p) hi = mid;
	  else lo = mid;
    }
    return hi;
}
void rem(int p, int t)
{
    int pos = find_(t, p);
    //cout << pos << endl;
    mark[t][pos - 1] = 1;
    set_(t, pos, -1);
}
main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    int n; cin >> n;
    string s; cin >> s; string d;

    for(int i = 0; i < n; i ++) d += s;

    for(int i = 0; i < d.size(); i ++)
	  a[d[i] - 'a'].push_back(i), set_(d[i] - 'a', a[d[i] - 'a'].size(), 1);
    //cout << get(0, 2) << endl;
    int q; cin >> q;
    while(q --)
    {
	  int p; char c;  cin >> p >> c;
	  rem(p, c - 'a');
    }

    vector< pair<int, char> > ans;
    for(int i = 0; i < 30; i ++)
	  for(int j = 0; j < a[i].size(); j ++)
		if(!mark[i][j]) ans.push_back(make_pair(a[i][j], i));
    sort(ans.begin(), ans.end());
    for(int i = 0; i < ans.size(); i ++)
	  cout << char(ans[i].second + 'a');
    cout << endl;
    return 0;
}


#include <cstring>
#include <vector>
#include <iostream>
#include <deque>
using namespace std;
int k,n;
string s;
typedef pair<int,char> P;
P query[200000];
deque<int> letter_indexes[26];
char in1[1000000];
char in2[1000000];

int main() {
	cin>>k>>s;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>query[i].first>>query[i].second;
	}
	string name="";
	for(int i=0;i<k;i++)name+=s;

	for(int i=0;i<name.size();i++){
		char letter=name[i]-'a';
		letter_indexes[letter].push_back(i);
	}
	for(int i=0;i<n;i++){
		int position=query[i].first;
		int letter=query[i].second-'a';
		deque<int>&indexes=letter_indexes[letter];
		if(indexes.size()>=position){
			name[indexes[position-1]]='0';
			letter_indexes[letter].erase(letter_indexes[letter].begin()+position-1);
		}
	}
	for(int i=0;i<name.size();i++){
		if(name[i]=='0')continue;
		cout<<name[i];
	}
	cout<<endl;
	return 0;
}


//============================================================================
// Name        : CF159C_.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <vector>
#include <iostream>
using namespace std;
int k,n;
string s;
typedef pair<int,char> P;
P query[200000];
vector<int> letter_indexes[26];
int main() {
	cin>>k>>s;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>query[i].first>>query[i].second;
	}
	string name="";
	for(int i=0;i<k;i++)name+=s;

	for(int i=0;i<name.size();i++){
		char letter=name[i]-'a';
		letter_indexes[letter].push_back(i);
	}
	for(int i=0;i<n;i++){
		int position=query[i].first;
		int letter=query[i].second-'a';
		vector<int>&indexes=letter_indexes[letter];
		if(indexes.size()>=position){
			name[indexes[position-1]]='0';
			letter_indexes[letter].erase(letter_indexes[letter].begin()+position-1);
		}
	}
	for(int i=0;i<name.size();i++){
		if(name[i]=='0')continue;
		cout<<name[i];
	}
	cout<<endl;
	return 0;
}


#include <cstring>
#include <vector>
#include <iostream>
#include <deque>
using namespace std;
int k,n;
string s;
typedef pair<int,char> P;
P query[200000];
deque<int> letter_indexes[26];
char in1[1000000];
char in2[1000000];

int main() {
	for(int i=0;i<1000;i++){
		memmove(in1,in2,1000000);
		               //000000
	}
	return 0;
	cin>>k>>s;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>query[i].first>>query[i].second;
	}
	string name="";
	for(int i=0;i<k;i++)name+=s;

	for(int i=0;i<name.size();i++){
		char letter=name[i]-'a';
		letter_indexes[letter].push_back(i);
	}
	for(int i=0;i<n;i++){
		int position=query[i].first;
		int letter=query[i].second-'a';
		deque<int>&indexes=letter_indexes[letter];
		if(indexes.size()>=position){
			name[indexes[position-1]]='0';
			letter_indexes[letter].erase(letter_indexes[letter].begin()+position-1);
		}
	}
	for(int i=0;i<name.size();i++){
		if(name[i]=='0')continue;
		cout<<name[i];
	}
	cout<<endl;
	return 0;
}


//solution by Wsl_F
#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <cmath>
#include <math.h>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <bitset>
#include <numeric>
#include <cassert>
#include <time.h>
#include <ctime>
#include <memory.h>
#include <complex>
#include <utility>
#include <climits>
#include <cctype>
#include <x86intrin.h>

using namespace std;
#pragma comment(linker, "/STACK:1024000000,1024000000")

typedef long long LL;
typedef unsigned long long uLL;
typedef double dbl;
typedef vector<int> vi;
typedef vector<LL> vL;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<LL,LL> pLL;

#define mp(x,y)  make_pair((x),(y))
#define pb(x)  push_back(x)
#define sqr(x) ((x)*(x))

template <typename T>
class FenwickSum
{
#define F(x) ((x)&((x)+1))
#define H(x) ((x)|((x)+1))

private:
    int n;
    T* a;

public:
    FenwickSum()
    {
    }

    FenwickSum(int n0)
    {
        initialization(n0);
    }

    FenwickSum(int n0, T* b)
    {
        initialization(n0);
        build(b);
    }

    void update(int i, T value)
    {
        while (i<n)
        {
            a[i]+= value;
            i= H(i);
        }
    }

    T sum(int k)
    {
        if (k<0) return T();
        T s= T();
        while (k>=0)
        {
            s+= a[k];
            k= F(k)-1;
        }
        return s;
    }

    T sum(int l, int r)
    {
        return (sum(r)-sum(l-1));
    }

    T value(int i)
    {
        return (sum(i)-sum(i-1));
    }

    void build(int n0, T* b)
    {
        initialization(n0);
        build(b);
    }

    void build(T* b)
    {
        for (int i=0; i<n; i++)
            update(i,b[i]);
    }

private:
    void initialization(int n0)
    {
        n= n0;
        a= new T[n];
        T zero= T();
        for (int i=0; i<n; i++)
            a[i]= zero;
    }

#undef F(x)
#undef H(x)
};

const int NMAX= 200*1000;
int ar[NMAX];

int pos[30];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    srand(__rdtsc());
// LL a[110];
// memset(a,0,sizeof(a));

    //freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
//cout<<fixed;
//cout<<setprecision(9);

    int n,k,p;
    char c;
    string s;
    cin>>k;
    cin>>s;
    cin>>n;
    for (int i= 0; i<NMAX; i++)
        ar[i]= 1;

    FenwickSum<int> ft [30];

    for (int i= 0; i<='z'-'a'; i++)
        ft[i].build(NMAX,ar);

    for (int i=0; i<n; i++)
    {
        cin>>p>>c;
        int l= 0;
        int r= NMAX-1;
        int mid;
        int j= c-'a';
        while (l<r)
        {
            mid= (l+r)/2;
            if (ft[j].sum(mid)<p) l= mid+1;
            else r= mid;
        }
        //cout<<ft[j].value(r)<<" ";
        ft[j].update(r,-1);
  //      cout<<r<<" "<<ft[j].value(r)<<endl;
    }

//cout<<endl;
    int l= s.length();
    int L= l*k;
    for (int i= 0; i<L; i++)
    {
       int j= s[i%l]-'a';
//       cout<<pos[j]<<" "<<ft[j].value(pos[j])<<endl;
       if (ft[j].value(pos[j])) cout<<char(j+'a');
       pos[j]++;
    }
    cout<<endl;

    return 0;
}


//solution by Wsl_F
#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <cmath>
#include <math.h>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <bitset>
#include <numeric>
#include <cassert>
#include <time.h>
#include <ctime>
#include <memory.h>
#include <complex>
#include <utility>
#include <climits>
#include <cctype>
#include <x86intrin.h>

using namespace std;
#pragma comment(linker, "/STACK:1024000000,1024000000")

typedef long long LL;
typedef unsigned long long uLL;
typedef double dbl;
typedef vector<int> vi;
typedef vector<LL> vL;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<LL,LL> pLL;

#define mp(x,y)  make_pair((x),(y))
#define pb(x)  push_back(x)
#define sqr(x) ((x)*(x))

vi v[30];
int t[30];
int indV[30];

int main()
{
 ios_base::sync_with_stdio(0);
 cin.tie(0);
 srand(__rdtsc());
 // LL a[110];
 // memset(a,0,sizeof(a));

 freopen("input.txt","r",stdin);
 //freopen("output.txt","w",stdout);
 //cout<<fixed;
 //cout<<setprecision(9);

 int n,k,p;
 char c;
 string s;
 cin>>k;
 cin>>s;
 cin>>n;

 for (int i= 0; i<n; i++)
 {
    cin>>p>>c;
    v[c-'a'].pb(p);
 }

 for (int i= 0; i<= 'z'-'a'; i++)
 {
    sort(v[i].begin(),v[i].end());
    v[i].pb(-1);
    v[i].pb(-1);
    v[i].pb(-1);
 }

 int l= s.length();
 int L= l*k;

 int j;
 for (int i= 0; i<L; i++)
 {
    j= s[i%l]-'a';
    if (t[j]+1==v[j][indV[j]]) indV[j]++;
    else {t[j]++; cout<<char('a'+j);}
 }
 cout<<endl;
 return 0;
}