1 #include<cstdio>
2 #include<cstring>
3 #include<cmath>
4 #include<algorithm>
5
6 #define maxn 1001
7
8 using namespace std;
9
10 inline int in()
11 {
12 int x=0;char ch=getchar();
13 while(ch<‘0‘||ch>‘9‘)ch=getchar();
14 while(ch>=‘0‘&&ch<=‘9‘)x=x*10+ch-‘0‘,ch=getchar();
15 return x;
16 }
17
18 int n,l,last[maxn],tot=0,sta[maxn],top=0,father[maxn],root[maxn],cnt=0;
19
20 struct ed{
21 int to,last;
22 }edge[maxn*2];
23
24 void add(int u,int v)
25 {
26 edge[++tot].to=v,edge[tot].last=last[u],last[u]=tot;
27 edge[++tot].to=u,edge[tot].last=last[v],last[v]=tot;
28 }
29
30 void dfs(int poi,int Last)
31 {
32 int lim=top;
33 for(int i=last[poi];i;i=edge[i].last)if(edge[i].to!=Last){
34 dfs(edge[i].to,poi);
35 if(top-lim>=l)
36 {
37 root[++cnt]=poi;
38 while(top!=lim)father[sta[top--]]=cnt;
39 }
40 }
41 sta[++top]=poi;
42 }
43
44 int main()
45 {
46 int u,v;
47 n=in();l=in();
48 for(int i=1;i<n;i++)
49 u=in(),v=in(),add(u,v);
50 dfs(1,0);
51 while(top)father[sta[top--]]=cnt;
52 printf("%d\n",cnt);
53 for(int i=1;i<=n;i++)printf("%d ",father[i]);
54 printf("\n");
55 for(int i=1;i<=cnt;i++)printf("%d ",root[i]);
56 return 0;
57 }