This page is still under construction.

Parts of this page are still being built. What you see may change.

Automated Checking Machine

Time limit3sMemory limit256 MB

Summary
Check two five-point connectors and print Y only when each position pairs a plug with an outlet.
Level

Easy1 of 10

Topics
Implementation
Solved
No attempts yet

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 0≤Xi≤10 \le X_i \le 1 and 0≤Yi≤10 \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.

Examples2

  1. Example 1

    Input
    1 1 0 1 0
    0 0 1 0 1
    
    Expected output
    Y
    
  2. Example 2

    Input
    1 0 0 1 0
    1 0 1 1 0
    
    Expected output
    N