logo AlgoBeat OnlineJudge
登录 注册

#215198. [UOI 2023 II Stage] Roads of Potokolandiya

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

In Potokoland, there are cities and two-way roads. The -th road connects cities and (if , then ).

For example, if , the roads will be , , , , and .

Determine if it is possible to travel from any city to any other city using the roads. If not, find a pair of cities that are not connected.

输入格式

The first line contains one integer ().

输出格式

Output if it is possible to travel from any city to any other city.

Otherwise, output on the first line. On the second line, output any two cities and (; ) such that it is impossible to travel from to using the roads.

样例

样例输入 1

5

样例输出 1

NO
1 5

样例输入 2

4

样例输出 2

YES

样例输入 3

7

样例输出 3

NO
1 7

样例输入 4

8

样例输出 4

YES