#include<stdio.h>
#include<stdlib.h>
struct ele
{
int num;
int value;
ele *next;
}p[125];
int main()
{
int n,m;
ele *t;
scanf("%d%d",&n,&m);
int i,j,k;
for(i=1;i<=n;i++)
{
p[i].num=i;
p[i].value=-1;
p[i].next=NULL;
}
while(m--)
{
scanf("%d%d",&i,&j);
t=(ele*)malloc(sizeof(ele));//1
t->num=j; //2
t->value=1; //3
t->next=p[i].next; //4
p[i].next=t; //5
t=(ele*)malloc(sizeof(ele));
t->num=i; //1
t->value=1; //2
t->next=p[j].next; //3
p[j].next=t; //4
}
ele *q;
for(i=1;i<=n;i++)
{
q=&p[i];
while(q!=NULL)
{
printf("%d\n",q->num);
q=q->next;
}
printf("\n");
}
return 0;
}
#include<stdlib.h>
struct ele
{
int num;
int value;
ele *next;
}p[125];
int main()
{
int n,m;
ele *t;
scanf("%d%d",&n,&m);
int i,j,k;
for(i=1;i<=n;i++)
{
p[i].num=i;
p[i].value=-1;
p[i].next=NULL;
}
while(m--)
{
scanf("%d%d",&i,&j);
t=(ele*)malloc(sizeof(ele));//1
t->num=j; //2
t->value=1; //3
t->next=p[i].next; //4
p[i].next=t; //5
t=(ele*)malloc(sizeof(ele));
t->num=i; //1
t->value=1; //2
t->next=p[j].next; //3
p[j].next=t; //4
}
ele *q;
for(i=1;i<=n;i++)
{
q=&p[i];
while(q!=NULL)
{
printf("%d\n",q->num);
q=q->next;
}
printf("\n");
}
return 0;
}