5753: 立方体星球

内存限制:256 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:7 通过:3

题目描述

       您可以在我们的银河系中找到任何东西!立方体行星绕二十面体恒星运行。让我们引入一个轴系统,使立方体行星的边缘平行于坐标轴,并且两个相反的顶点位于点 (0,0,0) 和 (1,1,1) 中。地球上生活着两只苍蝇。目前,他们正坐在立方体行星的两个不同顶点上。你的任务是确定他们是否看到对方。当苍蝇占据的顶点位于立方体的同一面时,它们会互相看到。

You can find anything whatsoever in our Galaxy! A cubical planet goes round an icosahedral star. Let us introduce a system of axes so that the edges of the cubical planet are parallel to the coordinate axes and two opposite vertices lay in the points (0,0,0) and (1,1,1). Two flies live on the planet. At the moment they are sitting on two different vertices of the cubical planet. Your task is to determine whether they see each other or not. The flies see each other when the vertices they occupy lie on the same face of the cube.
Input
The first line contains three space-separated integers (0 or 1) − the coordinates of the first fly, the second line analogously contains the coordinates of the second fly.
Output
Output "YES" (without quotes) if the flies see each other. Otherwise, output "NO".
Examples
Input
0 0 0
0 1 0
Output
YES
Input
1 1 0
0 1 0
Output
YES
Input
0 0 0
1 1 1
Output
NO

输入格式

第一行包含三个空格分隔的整数(0 或 1) - 第一个苍蝇的坐标,第二行类似地包含第二个苍蝇的坐标。

输出格式

 如果苍蝇看到对方,则输出“YES”(不带引号)。否则,输出“否”。
Examples
Input
0 0 0
0 1 0
Output
YES
Input
1 1 0
0 1 0
Output
YES
Input
0 0 0
1 1 1
Output
NO


输入样例 复制

0 0 0
0 1 0

输出样例 复制

YES

分类标签