Tree
题号:NC244815
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
Special Judge, 64bit IO Format: %lld

题目描述

There is a country of n cities, and the capital of this country is city 1.

The cities of this country are interconnected by n-1 roads, forming a rooted tree, and the root of this tree is 1.

You are a mattress tester who is in the capital of this country right now and you are planning a trip.

You have the following requirements for this trip.

1. Each city in this country is very different, so you plan to sleep in each city for exactly one night (you must sleep in a hotel in a particular city each night).

2. The distance between the cities where each of your adjacent nights are located, for time reasons, cannot exceed k .

The distance between two cities is defined as the number of roads of a simple path between them.

A simple path is a path that does not go through repeating nodes.

If there is a travel option that satisfies the condition, output ``Yes`` and output the city you are in each night.

Otherwise, output ``No``.


输入描述:

There are two lines of input, the first line inputs two positive integers  and .

The second line has n-1 positive integers separated by spaces, where the i th positive integer is city 's father.

输出描述:

The first line outputs ``Yes`` or ``No``, indicates the existence of a legitimate travel program

If the legitimate travel program exists, output n integers separated by spaces, the i -th integer indicates the city where the i -th night is located. If more than one travel option exists that satisfies the condition, output any one of them.


示例1

输入

复制
5 1
1 1 2 3

输出

复制
No
示例2

输入

复制
7 2
1 1 2 2 3 3

输出

复制
Yes
1 7 6 3 2 5 4
示例3

输入

复制
13 3
1 1 1 2 2 2 3 3 3 4 4 4

输出

复制
Yes
1 13 12 11 4 10 9 8 3 7 6 5 2