Currency converter

You are using an on-line currency converter because you are curious
about several changes. You notice that they give you 0.8 pounds for one
euro, 1.4 dollars for one pound, and 0.9 euros for one dollar. Mmm...
what? Wait a moment... So they really give you 1.008 euros for one
euro??? Hurry up, you can get rich!

Input

Input consists of several cases. Every case begins with the number of
direct changes m. Follow m triples with two different names of
currencies x and y, and the number of y’s given for one x (a real number
between 0.6 and 1.5). Assume 2 ≤ m ≤ 1000. There is at most one direct
change from x to y for every pair of currencies x and y.

Output

For every case, print “YES!!!” if you can get rich, and print “NO”
otherwise. Assume that, initially, you have a small amount of every
currency. The input cases have no precision issues.

Problem information

Author: Enric Rodríguez

Generation: 2026-01-25T12:01:10.258Z

© Jutge.org, 2006–2026.
https://jutge.org
