#abc366g. G - XOR Neighbors

G - XOR Neighbors

Score : 600600 points

问题陈述

给定一个简单的无向图,包含 NN 个顶点和 MM 条边。第 ii 条边双向连接顶点 uiu_iviv_i

确定是否存在一种方法,为这个图的每个顶点写上一个介于 1126012^{60} - 1(包括两端)之间的整数,以满足以下条件:

  • 对于每个度数至少为 11 的顶点 vv,其相邻顶点(不包括 vv 本身)上写的数字的总异或值为 00

什么是异或?两个非负整数 AABB 的异或,记作 ABA \oplus B,定义如下:

  • ABA \oplus B 的二进制表示中,位置 2k(k0)2^k \, (k \geq 0) 的位是 11 当且仅当在 AABB 的二进制表示中位置 2k2^k 的位中恰好有一个是 11。否则,它是 00

例如,35=63 \oplus 5 = 6(二进制:011101=110011 \oplus 101 = 110)。 一般来说,kk 个整数 p1,,pkp_1, \dots, p_k 的按位异或定义为 $(\cdots ((p_1 \oplus p_2) \oplus p_3) \oplus \cdots \oplus p_k)$。可以证明,这与 p1,,pkp_1, \dots, p_k 的顺序无关。

以上为大语言模型 kimi 翻译,仅供参考。

Problem Statement

You are given a simple undirected graph with NN vertices and MM edges. The ii-th edge connects vertices uiu_i and viv_i bidirectionally.

Determine if there exists a way to write an integer between 11 and 26012^{60} - 1, inclusive, on each vertex of this graph so that the following condition is satisfied:

  • For every vertex vv with a degree of at least 11, the total XOR of the numbers written on its adjacent vertices (excluding vv itself) is 00.

What is XOR? The XOR of two non-negative integers AA and BB, denoted as ABA \oplus B, is defined as follows:

  • In the binary representation of ABA \oplus B, the bit at position 2k(k0)2^k \, (k \geq 0) is 11 if and only if exactly one of the bits at position 2k2^k in the binary representations of AA and BB is 11. Otherwise, it is 00.

For example, 35=63 \oplus 5 = 6 (in binary: 011101=110011 \oplus 101 = 110).
In general, the bitwise XOR of kk integers p1,,pkp_1, \dots, p_k is defined as $(\cdots ((p_1 \oplus p_2) \oplus p_3) \oplus \cdots \oplus p_k)$. It can be proved that this is independent of the order of p1,,pkp_1, \dots, p_k.

Constraints

  • 1N601 \leq N \leq 60
  • 0MN(N1)/20 \leq M \leq N(N-1)/2
  • 1ui<viN1 \leq u_i < v_i \leq N
  • (ui,vi)(uj,vj)(u_i, v_i) \neq (u_j, v_j) for iji \neq j.
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

NN MM

u1u_1 v1v_1

u2u_2 v2v_2

\vdots

uMu_M vMv_M

Output

If there is no way to write integers satisfying the condition, print No.

Otherwise, let XvX_v be the integer written on vertex vv, and print your solution in the following format. If multiple solutions exist, any of them will be accepted.

Yes

X1X_1 X2X_2 \dots XNX_N

Sample Input 1

3 3
1 2
1 3
2 3

Sample Output 1

Yes
4 4 4

Other acceptable solutions include writing (2,2,2)(2,2,2) or (3,3,3)(3,3,3).

Sample Input 2

2 1
1 2

Sample Output 2

No

Sample Input 3

1 0

Sample Output 3

Yes
1

Any integer between 11 and 26012^{60} - 1 can be written.

Sample Input 4

4 5
1 2
1 3
2 3
2 4
3 4

Sample Output 4

Yes
12 4 4 8
}