1 /*************************************************************************
2 > File Name: code/hust/20151025/H.cpp
3 > Author: 111qqz
4 > Email: rkz2013@126.com
5 > Created Time: 2015年10月27日 星期二 19时30分28秒
6 ************************************************************************/
7
8 #include<iostream>
9 #include<iomanip>
10 #include<cstdio>
11 #include<algorithm>
12 #include<cmath>
13 #include<cstring>
14 #include<string>
15 #include<map>
16 #include<set>
17 #include<queue>
18 #include<vector>
19 #include<stack>
20 #include<cctype>
21
22 #define yn hez111qqz
23 #define j1 cute111qqz
24 #define ms(a,x) memset(a,x,sizeof(a))
25 #define pb push_back
26 using namespace std;
27 const int dx4[4]={1,0,0,-1};
28 const int dy4[4]={0,-1,1,0};
29 typedef long long LL;
30 typedef double DB;
31 const int inf = 0x3f3f3f3f;
32 const int N=5E4+7;
33
34 int n,m,k;
35 vector<int> adj[N];
36 vector<pair< pair<int,int> ,int> > ans;
37 int pa[N];
38 int kt[N];
39 bool spe[N];
40 void init()
41 {
42 ms(spe,false);
43 ms(pa,0);
44 scanf("%d %d %d",&n,&m,&k);
45 for ( int i = 0,u,v; i < m ; i++)
46 {
47 scanf("%d %d",&u,&v);
48 adj[u].push_back(v);
49 adj[v].push_back(u);
50 }
51
52 for ( int i = 0,u ; i < k ; i++)
53 {
54 scanf("%d",&u);
55 spe[u] = true;
56 }
57
58 }
59
60 void dfs( int u)
61 {
62 // cout<<"u:"<<u<<endl;
63 vector<int> tmp;
64 tmp.clear();
65
66 for ( int j = 0 ; j < adj[u].size(); j++)
67 {
68 int v =adj[u][j];
69 if (pa[v]==0)
70 {
71 pa[v] = u;
72 dfs(v);
73 if (kt[v]) tmp.push_back(kt[v]);
74 }
75 }
76 while (tmp.size()>1)
77 {
78 int x1 = tmp.back();tmp.pop_back();
79 int x2 = tmp.back(); tmp.pop_back();
80 // cout<<"x1:"<<x1<<" x2:"<<x2<<endl;
81 ans.pb(make_pair(make_pair(x1,x2),u));
82 }
83 if (tmp.size()>0)
84 {
85 int x = tmp.back();tmp.pop_back();
86
87 // cout<<"x:"<<x<<endl;
88 if (spe[u])
89 {
90 ans.push_back(make_pair(make_pair(x,u),u));
91 }
92 else kt[u] = x;
93 }
94 else
95 {
96 if (spe[u]) kt[u] = u;
97 }
98 }
99
100 void solve()
101 {
102 for ( int i = 1 ; i <n+1 ; i++)
103 if (!pa[i])
104 {
105 pa[i] = -1;
106 dfs(i);
107 }
108
109 vector<int>p,q;
110 // printf("%d\n",ans.size());
111 cout<<ans.size()<<endl;
112 for ( int i = 0 ; i < ans.size(); i++)
113 {
114 int u = ans[i].first.first;
115 int v = ans[i].first.second;
116 int r = ans[i].second;
117 // cout<<"************************"<<endl;
118 // cout<<"u:"<<u<<" v:"<<v<<" r:"<<r<<endl;
119 // cout<<"************************"<<endl<<endl;
120
121 p.clear();
122 q.clear();
123 while (u!=r)
124 {
125 p.push_back(u);
126 u = pa[u];
127 }
128
129 while (v!=r)
130 {
131 q.push_back(v);
132 v = pa[v];
133 }
134
135 //printf("%d ",p.size()+q.size());
136 cout<<p.size()+q.size()<<" ";
137 for ( int j = 0 ; j < p.size(); j++) printf("%d ",p[j]);
138 printf("%d ",r);
139
140 reverse(q.begin(),q.end());
141 for ( int j = 0 ; j < q.size(); j++) printf("%d ",q[j]);
142 puts("");
143
144 }
145 }
146 int main()
147 {
148 #ifndef ONLINE_JUDGE
149 freopen("in.txt","r",stdin);
150 #endif
151 init();
152 solve();
153
154
155 #ifndef ONLINE_JUDGE
156 fclose(stdin);
157 #endif
158 return 0;
159 }