213. Strong Defence

time limit per test: 0.25 sec.
memory limit per test: 65536 KB
input: standard
output: standard

The Chief of the Galactic Empire has recently received some bad news from his spies. The Dark Lord is preparing to attack the Empire. His fleet of spaceships is ready for the first hyperjump.

It is well known that travelling in space is very simple. You just start from some star and make a series of hyperjumps to other stars. You can only jump from one star to another if they are connected with a special hyperjump tunnel, which is bidirectional, thus allowing to make a jump from one star that it connects to another. Of course, the tunnels are designed in such a way that there is the way to get from each star to any other one.

However, there is the way to block the hyperjump — to do this one must put a special battleship in the corresponding hypertunnel.

Of course, the Chief would like to block all hyperpaths from the star where the headquaters of the Dark Lord are located to the star where the capital of the Galactic Empire is. The resources of the Empire are almost unbounded, so it is easy to create as many battleships as needed. Unfortunately, there is one problem.

Each hyperjump blocking battleship must have a special crystal on board which allows him to stay in the hyperspace. There is a number of types of such crystals. The problem is that there is the way to destroy all battleships carrying some particular type of crystal.

Although it is known, that for each crystal type there is the way to destroy battleships powered by this crystal, there is hope that not all of those are known to Dark Lord engineers. So the Chief would like to use blocking ships in such a way that the following conditions are satisfied:

You may consider that there is the unlimited number of crystal types available and crystals of each type available.


The first line of the input file contains N — the number of stars in the Galaxy(2 ≤ N ≤ 400), M -- the number of tunnels, S and T — numbers of stars where Dark Lord headquaters and Empire Capital are located respectively (S ≠ T).

Next M lines contain two integer numbers each — the numbers of the stars the corresponding tunnel connects. No tunnel connects a star to itself, no two stars are connected with more than one tunnel.


First output L — the number of crystal types used. After that output L lines, for each crystal type output first Ki — the number of battleships with this crystal used, and then Ki numbers, identifying the hypertunnels blocked by the corresponding battleship. The tunnels are numbered starting from 1, as they are given in the input file.

Sample test(s)

4 4 1 4
1 2
1 3
2 4
3 4

2 1 2
2 3 4

Author:Andrew Stankevich
Resource:Petrozavodsk Summer Trainings 2003

Server time: 2018-02-22 10:06:45Online Contester Team © 2002 - 2016. All rights reserved.