ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

1190. Bar of Chocolate

Time limit: 1.0 second
Memory limit: 64 MB
On the wrapper of a bar of chocolate, the producer must specify all the components of the product. Strictly speaking, producers should also specify the weight fractions of all the components, but most of them do not do so because the consumers won't buy a chocolate if they read, for example, "Water 80%". However, producers prefer to specify the weight fractions of some components. For example, the inscription "Whole nuts 90%" is likely to attract buyers. But the buyer must remember that the components are always written in non-increasing order of weight fractions. Accordingly, the beautiful inscription "Cocoa-butter, Water, Cocoa-powder 40%", evidently, is a lie.
Write a program that determines whether an inscription on a bar of chocolate is a lie.

Input

The first line contains the number of components N (1 ≤ N ≤ 5000). Each of the following N lines contains a description of one component. Each description starts with the name of the component, which is no longer than 16 symbols and may contain only upper- or lowercase English letter, hyphens, and underline characters. All the components have different names. Then there is a space followed by the number 0 or 1; 0 means that the producer didn't specify the weight fraction of the component. If the number is 1, it is followed by a space and the weight fraction given in hundredths of percent. All specified weight fractions are given in non-increasing order. Weight fractions, both real and specified on the wrapper, are integers from 1 to 10000 (in hundredths of percent).

Output

Output NO if the inscription is certainly a lie; output YES if the inscription is consistent and can be true.

Sample

inputoutput
4
Water 0
Cocoa-butter 0
Cocoa-powder 1 4000
Lecithin 0
NO
Problem Author: Leonid Volkov
Problem Source: Fifth High School Children Programming Contest, Ekaterinburg, March 02, 2002