Spider’s Web

time limit per test

2 seconds

memory limit per test

256 megabytes


standard input


standard output

Paw the Spider is making a web. Web-making is a real art, Paw has been learning to do it his whole life. Let’s consider the structure of the web.

There are