P27132 [AtCoder] Path
入门
题目描述

Problem Description

There are 4 towns numbered 1, 2, 3, and 4. There are 3 roads, and the i-th road connects different towns \(a_i\) and \(b_i\) bidirectionally. There are no multiple roads connecting the same pair of towns. The only means of traveling between towns are these roads. Any pair of towns can be traveled between by using some number of roads.

Determine if it is possible to visit all towns by traversing each road exactly once.

Input Format

The input is given from the standard input in the following format:

\(a_1\) \(b_1\) \(a_2\) \(b_2\) \(a_3\) \(b_3\)

Output Format

Output YES if it is possible to visit all towns by traversing each road exactly once, otherwise output NO.

Sample Input and Output

Sample Input #1

4 2
1 3
2 3

Sample Output #1

YES

Sample Input #2

3 2
2 4
1 2

Sample Output #2

NO

Sample Input #3

2 1
3 2
4 3

Sample Output #3

YES

Notes/Hints

Constraints

  • \(1 \leq a_i, b_i \leq 4 \quad (1 \leq i \leq 3)\)
  • \(a_i\) and \(b_i\) are different \((1 \leq i \leq 3)\)
  • There are no multiple roads connecting the same pair of towns
  • Any pair of towns can be traveled between by using some number of roads

Sample Explanation 1

It is possible to visit the towns in the order 1, 3, 2, 4.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4 2 1 3 2 3
样例输出
YES