Cryptarithm?!

Given three letter strings A+B=C, decide whether some assignment of distinct digits to letters makes the addition valid, columns up to 18 long.

Hard9BacktrackingMathCombinatoricsBrute forceNo attempts yetTime limit1sMemory limit128 MB

Problem

Cryptarithm is a mathematical puzzle in which each digit of a calculation is replaced by a letter, and the solver must recover which digit each letter stands for.

A well known instance is SEND+MORE=MONEYSEND+MORE=MONEY.

  SEND
+ MORE
------
 MONEY

Setting S=9S=9, E=5E=5, N=6N=6, D=7D=7, M=1M=1, O=0O=0, R=8R=8, Y=2Y=2 satisfies the equation.

  9567
+ 1085
------
 10652

Given a cryptarithm A+B=CA+B=C written with three words, determine whether any digit assignment satisfies it.

The same letter always maps to the same digit, and different letters map to different digits. Numbers may start with 00.

Input

Three words AA, BB, CC are given, separated by spaces. They state that adding the first word and the second word yields the third word.

Each word consists only of uppercase English letters with no spaces, and each word is at most 1818 characters long.

Output

Print YESYES on one line if any satisfying assignment exists, and NONO otherwise.

Hint

There can be many solutions, only existence matters. The input SUNSUN FUNFUN SWIMSWIM admits 4949 solutions, including 067+867=0934067+867=0934 and 167+867=1034167+867=1034.