#include <bits/stdc++.h>
using namespace std;
const int maxn = 400 + 20;
int n, m, s, t;
bool inq[maxn];
int g[maxn][maxn], dis[maxn];
vector<int> ans[maxn];
void spfa() {
queue<int> que;
memset(dis, 0x3f, sizeof dis);
que.push(s), dis[s] = 0, inq[s] = true;
while(!que.empty()) {
int u = que.front(); que.pop();
inq[u] = false;
for(int i = 1; i <= n; ++i) {
if(g[u][i] != 0 && dis[i] > dis[u] + 1) {
dis[i] = dis[u] + 1;
if(!inq[i]) {
que.push(i);
inq[i] = true;
}
}
}
}
}
int main() {
scanf("%d%d%d%d", &n, &m, &s, &t);
for(int i = 1; i <= m; ++i) {
int u, v;
scanf("%d%d", &u, &v);
g[u][v] = g[v][u] = i;
}
spfa();
for(int i = 1; i <= n; ++i) {
for(int j = 1; j <= n; ++j) {
if(g[i][j] && dis[j] == dis[i] + 1) {
ans[dis[i]].push_back(g[i][j]);
g[i][j] = g[j][i] = 0;
}
}
}
for(int i = 1; i <= n; ++i) {
for(int j = 1; j <= n; ++j) {
if(g[i][j]) {
ans[dis[t]].push_back(g[i][j]);
g[i][j] = g[j][i] = 0;
}
}
}
printf("%d\n", dis[t]);
for(int i = 0; i < dis[t]; ++i) {
printf("%d", (int)ans[i].size());
for(int j = 0, sz = ans[i].size(); j < sz; ++j) {
printf(" %d", ans[i][j]);
}
puts("");
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmNvbnN0IGludCBtYXhuID0gNDAwICsgMjA7CmludCBuLCBtLCBzLCB0OwoKYm9vbCBpbnFbbWF4bl07CmludCBnW21heG5dW21heG5dLCBkaXNbbWF4bl07CnZlY3RvcjxpbnQ+IGFuc1ttYXhuXTsKdm9pZCBzcGZhKCkgewoJcXVldWU8aW50PiBxdWU7CgltZW1zZXQoZGlzLCAweDNmLCBzaXplb2YgZGlzKTsKCXF1ZS5wdXNoKHMpLCBkaXNbc10gPSAwLCBpbnFbc10gPSB0cnV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