#C6272. Flowerbed Arrangement

    ID: 50014 Type: Default 1000ms 256MiB

Flowerbed Arrangement

Flowerbed Arrangement

Alice has n flowerbeds and a list of preferences regarding the number of flowerbeds that should be planted with certain types of flowers. Each preference is a pair (flower type, required count). Your task is to determine whether it is possible to satisfy all the preferences. In other words, check if for every flower type, the required count does not exceed n. Formally, for each preference with required count (c), the condition (c \leq n) must hold. If all preferences satisfy this condition, print "YES"; otherwise, print "NO".

inputFormat

The first line contains three integers (n), (k) and (m), where (n) is the number of flowerbeds, (k) is an auxiliary parameter, and (m) is the number of preferences. Each of the next (m) lines contains a string and an integer, representing a flower type and the required number of flowerbeds for that type, respectively.

Example: 10 2 2 roses 3 lilies 2

outputFormat

Print a single line containing "YES" if it is possible to satisfy all of Alice's preferences; otherwise, print "NO".## sample

10 2 2
roses 3
lilies 2
YES