#include <bits/stdc++.h>
using namespace std;
const int maxN = 501, maxM = 1001;
const int INF = 0x3f3f3f3f;
int N, M, K, p[maxN], d[maxN];
bool inq[maxN], vis[maxM];
vector<int> path, G[maxN];
struct Edge {
int u, v, r, c;
} edges[maxM], redges[maxM];
void bellman_ford(){
fill(inq+1, inq+N+1, false);
fill(d+1, d+N+1, INF);
fill(p+1, p+N+1, 0);
queue<int> Q;
Q.push(1);
d[1] = 0;
inq[1] = true;
while(!Q.empty()){
int u = Q.front(); Q.pop();
inq[u] = false;
for(int i : G[u]){
Edge e = (i < 0 ? redges[-i] : edges[i]);
if(e.r > 0 && d[e.v] > d[u] + e.c){
d[e.v] = d[u] + e.c;
p[e.v] = i;
if(!inq[e.v]){
inq[e.v] = true;
Q.push(e.v);
}
}
}
}
}
int minimum_cost_flow(){
int flow = 0, cost = 0;
while(flow < K){
bellman_ford();
if(d[N] == INF) break;
int aug = K-flow;
int u = N;
while(u != 1){
Edge e = (p[u] < 0 ? redges[-p[u]] : edges[p[u]]);
aug = min(aug, e.r);
u = e.u;
}
flow += aug;
cost += aug * d[N];
u = N;
while(u != 1){
if(p[u] < 0){
redges[-p[u]].r -= aug;
edges[-p[u]].r += aug;
} else {
redges[p[u]].r += aug;
edges[p[u]].r -= aug;
}
u = (p[u] < 0 ? redges[-p[u]].u : edges[p[u]].u);
}
}
return (flow < K ? -1 : cost);
}
void dfs(int u = 1){
path.push_back(u);
if(u == N) return;
for(int i : G[u]){
if(i > 0 && edges[i].r == 0 && !vis[i]){
vis[i] = true;
dfs(edges[i].v);
return;
}
}
}
int main(){
scanf("%d %d %d", &N, &M, &K);
for(int i = 1, u, v; i <= M; i++){
scanf("%d %d", &u, &v);
G[u].push_back(i);
G[v].push_back(-i);
edges[i] = {u, v, 1, 1};
redges[i] = {v, u, 0, -1};
}
int minCoins = minimum_cost_flow();
if(minCoins == -1){
printf("-1\n");
return 0;
}
printf("%d\n", minCoins);
for(int i = 0; i < K; i++){
path.clear();
dfs();
int sz = (int) path.size();
printf("%d\n", sz);
for(int j = 0; j < sz; j++)
printf("%d%c", path[j], (" \n")[j==sz-1]);
}
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmNvbnN0IGludCBtYXhOID0gNTAxLCBtYXhNID0gMTAwMTsKY29uc3QgaW50IElORiA9IDB4M2YzZjNmM2Y7CmludCBOLCBNLCBLLCBwW21heE5dLCBkW21heE5dOwpib29sIGlucVttYXhOXSwgdmlzW21heE1dOwp2ZWN0b3I8aW50PiBwYXRoLCBHW21heE5dOwoKc3RydWN0IEVkZ2UgewogICAgaW50IHUsIHYsIHIsIGM7Cn0gZWRnZXNbbWF4TV0sIHJlZGdlc1ttYXhNXTsKCnZvaWQgYmVsbG1hbl9mb3JkKCl7CiAgICBmaWxsKGlucSsxLCBpbnErTisxLCBmYWxzZSk7CiAgICBmaWxsKGQrMSwgZCtOKzEsIElORik7CiAgICBmaWxsKHArMSwgcCtOKzEsIDApOwoKICAgIHF1ZXVlPGludD4gUTsKICAgIFEucHVzaCgxKTsKICAgIGRbMV0gPSAwOwogICAgaW5xWzFdID0gdHJ1ZTsKICAgIHdoaWxlKCFRLmVtcHR5KCkpewogICAgICAgIGludCB1ID0gUS5mcm9udCgpOyBRLnBvcCgpOwogICAgICAgIGlucVt1XSA9IGZhbHNlOwoKICAgICAgICBmb3IoaW50IGkgOiBHW3VdKXsKICAgICAgICAgICAgRWRnZSBlID0gKGkgPCAwID8gcmVkZ2VzWy1pXSA6IGVkZ2VzW2ldKTsKICAgICAgICAgICAgaWYoZS5yID4gMCAmJiBkW2Uudl0gPiBkW3VdICsgZS5jKXsKICAgICAgICAgICAgICAgIGRbZS52XSA9IGRbdV0gKyBlLmM7CiAgICAgICAgICAgICAgICBwW2Uudl0gPSBpOwogICAgICAgICAgICAgICAgaWYoIWlucVtlLnZdKXsKICAgICAgICAgICAgICAgICAgICBpbnFbZS52XSA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgUS5wdXNoKGUudik7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9Cn0KCmludCBtaW5pbXVtX2Nvc3RfZmxvdygpewogICAgaW50IGZsb3cgPSAwLCBjb3N0ID0gMDsKICAgIHdoaWxlKGZsb3cgPCBLKXsKICAgICAgICBiZWxsbWFuX2ZvcmQoKTsKICAgICAgICBpZihkW05dID09IElORikgYnJlYWs7CgogICAgICAgIGludCBhdWcgPSBLLWZsb3c7CiAgICAgICAgaW50IHUgPSBOOwogICAgICAgIHdoaWxlKHUgIT0gMSl7CiAgICAgICAgICAgIEVkZ2UgZSA9IChwW3VdIDwgMCA/IHJlZGdlc1stcFt1XV0gOiBlZGdlc1twW3VdXSk7CiAgICAgICAgICAgIGF1ZyA9IG1pbihhdWcsIGUucik7CiAgICAgICAgICAgIHUgPSBlLnU7CiAgICAgICAgfQoKICAgICAgICBmbG93ICs9IGF1ZzsKICAgICAgICBjb3N0ICs9IGF1ZyAqIGRbTl07CiAgICAgICAgdSA9IE47CiAgICAgICAgd2hpbGUodSAhPSAxKXsKICAgICAgICAgICAgaWYocFt1XSA8IDApewogICAgICAgICAgICAgICAgcmVkZ2VzWy1wW3VdXS5yIC09IGF1ZzsKICAgICAgICAgICAgICAgIGVkZ2VzWy1wW3VdXS5yICs9IGF1ZzsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHJlZGdlc1twW3VdXS5yICs9IGF1ZzsKICAgICAgICAgICAgICAgIGVkZ2VzW3BbdV1dLnIgLT0gYXVnOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHUgPSAocFt1XSA8IDAgPyByZWRnZXNbLXBbdV1dLnUgOiBlZGdlc1twW3VdXS51KTsKICAgICAgICB9CiAgICB9CiAgICByZXR1cm4gKGZsb3cgPCBLID8gLTEgOiBjb3N0KTsKfQoKdm9pZCBkZnMoaW50IHUgPSAxKXsKICAgIHBhdGgucHVzaF9iYWNrKHUpOwogICAgaWYodSA9PSBOKSAgcmV0dXJuOwogICAgZm9yKGludCBpIDogR1t1XSl7CiAgICAgICAgaWYoaSA+IDAgJiYgZWRnZXNbaV0uciA9PSAwICYmICF2aXNbaV0pewogICAgICAgICAgICB2aXNbaV0gPSB0cnVlOwogICAgICAgICAgICBkZnMoZWRnZXNbaV0udik7CiAgICAgICAgICAgIHJldHVybjsKICAgICAgICB9CiAgICB9Cn0KCmludCBtYWluKCl7CiAgICBzY2FuZigiJWQgJWQgJWQiLCAmTiwgJk0sICZLKTsKICAgIGZvcihpbnQgaSA9IDEsIHUsIHY7IGkgPD0gTTsgaSsrKXsKICAgICAgICBzY2FuZigiJWQgJWQiLCAmdSwgJnYpOwogICAgICAgIEdbdV0ucHVzaF9iYWNrKGkpOwogICAgICAgIEdbdl0ucHVzaF9iYWNrKC1pKTsKICAgICAgICBlZGdlc1tpXSA9IHt1LCB2LCAxLCAxfTsKICAgICAgICByZWRnZXNbaV0gPSB7diwgdSwgMCwgLTF9OwogICAgfQoKICAgIGludCBtaW5Db2lucyA9IG1pbmltdW1fY29zdF9mbG93KCk7CiAgICBpZihtaW5Db2lucyA9PSAtMSl7CiAgICAgICAgcHJpbnRmKCItMVxuIik7CiAgICAgICAgcmV0dXJuIDA7CiAgICB9CgogICAgcHJpbnRmKCIlZFxuIiwgbWluQ29pbnMpOwogICAgZm9yKGludCBpID0gMDsgaSA8IEs7IGkrKyl7CiAgICAgICAgcGF0aC5jbGVhcigpOwogICAgICAgIGRmcygpOwoKICAgICAgICBpbnQgc3ogPSAoaW50KSBwYXRoLnNpemUoKTsKICAgICAgICBwcmludGYoIiVkXG4iLCBzeik7CiAgICAgICAgZm9yKGludCBqID0gMDsgaiA8IHN6OyBqKyspCiAgICAgICAgICAgIHByaW50ZigiJWQlYyIsIHBhdGhbal0sICgiIFxuIilbaj09c3otMV0pOwogICAgfQp9Cg==