There are many marmots live on the grasslands and they build many holes under the ground. There are N*N holes and they are arranged in a square, there may be an UNDIRECTED path between two adjacent holes.
All those marmots are living in the northwest hole, now the rainy season coming and they have to transfer to the southeast hole, because it is the highest.
Unfortunately, there is a bug in this underground system;these paths are unsubstantial, so that if too many marmots pass one path the path will be destroyed. We call the max marmots can pass a path as p-value. Now give you the p-value of each path, white a program to calculate how many marmots can transfer to the safe place.