- محدودیت زمان: ۱ ثانیه
- محدودیت حافظه: ۲۵۶ مگابایت
Amin hates his chemistry class. Niloufar, who has not finished her chemistry assignments yet, turns to Amin for help with balancing chemical reactions.
Balancing a reaction means adding coefficients in front of the reactants and products so that the number of each element on both sides of the reaction is equal.
Amin has no idea what chemistry is, but he knows that chemical element names start with an uppercase letter, followed by lowercase letters.
Help Amin to check whether the reaction is balanced or not. Note that the coefficients must be integers and should be in their simplest form.
ورودی
The first line of input contains a positive integer , representing the number of chemical reactions.
In the next lines, each line contains a chemical reaction.
It is guaranteed that the coefficients are less than .
خروجی
For each test, if the reaction is balanced, print YES
, otherwise print NO
مثالها
ورودی نمونه ۱
خروجی نمونه ۱
ارسال پاسخ برای این سؤال