Birthday
시간 제한7초메모리 제한256 MB
무방향 그래프의 정점을 k개의 비어 있지 않은 순서 있는 부분으로 나누되, 모든 간선의 양 끝이 같은 부분이나 이웃한 두 부분에 속하도록 해야 한다.
문제
Malvina wants to give Buratino a birthday present --- an undirected graph . Buratino is turning , and Malvina wants to reflect this date in the graph by splitting it into parts, that is, by presenting the set of nodes of the graph as pairwise disjoint subsets , , , . Naturally, in this partition, all of the subsets must be non-empty.
To demonstrate the connection between the past years, Malvina wants to split the graph in such a manner that for each of the edges , its end nodes and belonged to either the same or two adjacent subsets. Only subsets and are adjacent for every .
입력
The first line of the input file contains two space-separated numbers and --- the number of nodes in the graph ( ) and the number of parts ( ) that the graph must be divided into.
The graph is defined in an adjacency matrix . The following lines of the file each contain symbols. The th symbol of the th line equals '1' if there is an edge between the nodes and , and '0' if there is no edge between these nodes. It is guaranteed that the matrix is symmetrical ( = ), and that the matrix diagonal only contains zeroes ( = ).
출력
In the first line of the output file, print "Yep", if the graph can be split into parts in the desired manner. Next, print lines. The th line ( = , , , ) contains the description of the th part: first, print the number of nodes in , next print the indices of the nodes belonging to , separated by spaces, numbered in the same order as in the input data. If there are several ways of splitting the graph, print any one of them.
If it is impossible to split the graph into parts in the desired way, print "Nope".