404196: GYM101446 J Build The Tree

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

J. Build The Treetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Consider a tree on n vertices. Each pair of vertices is connected by a simple path. Your task is to construct a tree on n vertices such that the total length of paths between all unordered pairs of vertices is exactly m. The length of a path is the number of edges on the path.

Input

First line of the input contains two integers n and m (2 ≤ n ≤ 20, 1 ≤ m ≤ 10 000).

Output

If it is impossible to construct such a tree, print "NO".

Otherwise, print "YES" on the first line. Each of the next n - 1 lines must describe one edge and contain two integers between 1 and n: the numbers of vertices connected by the corresponding edge.

If more than one correct tree exists, you may print any one of them.

ExamplesInput
3 4
Output
YES
1 2
2 3
Input
3 5
Output
NO

加入题单

上一题 下一题 算法标签: