G. It is all about wisdom
time limit per test
11.0 s
memory limit per test
1024 MB
input
standard input
output
standard output
Foki is the president of the Martian United States of Altanie, Altanie is a very large and strange country. Each citizen in it has a positive integer wisdom value calculated based on her/his age and educational level (of course Foki has the maximum value). Altanie has a big map for all its roads, this map has the following properties: