Automated Checking Machine

No attempts yetTime limit3sMemory limit256 MB

Problem

The Internet Computer Parts Company (ICPC) is an online shop that sells computer parts. One of its best sellers is a set of two in-line electrical connectors. Packaging mistakes send customers connectors that do not fit each other, so this set is also the part that gets returned the most.

An in-line connector has five connection points, labelled 1 to 5. Each connection point is either a plug or an outlet. Two connectors are compatible when, at every label, one connection point is a plug and the other is an outlet, so a plug meets an outlet everywhere the two connectors touch.

ICPC is installing an Automated Checking Machine (ACM) with an optical checker that verifies whether the two connectors packed for a customer really are compatible. The expensive hardware is finished and the software is still missing.

Given the description of a pair of in-line connectors, decide whether they are compatible.

Input

The first line contains five integers X1,X2,,X5X_1, X_2, \ldots, X_5 separated by spaces, describing the connection points of the first connector. The second line contains five integers Y1,Y2,,Y5Y_1, Y_2, \ldots, Y_5 in the same format, describing the second connector. Every value satisfies 0Xi10 \le X_i \le 1 and 0Yi10 \le Y_i \le 1, where 0 is an outlet and 1 is a plug.

Output

Print one line with the uppercase letter Y if the connectors are compatible, and the uppercase letter N otherwise.