#P8633. [蓝桥杯 2015 国 B] 模型染色
[蓝桥杯 2015 国 B] 模型染色
Problem Description
In the movie Big Hero 6, Hiro can use his micro robots to combine into various shapes.
Now he has used his micro robots to build a big toy for kids to play with. To make it look nicer, he decided to color the toy.
Hiro’s toy consists of spherical vertices and edges connecting these vertices. The figure below shows a toy made of spherical vertices and edges, which looks like a ball-and-stick molecular model.

Because Hiro’s micro robots are very flexible, these spherical vertices can move freely in space, and the edges connecting adjacent vertices can stretch or shrink freely, so the toy can change into different shapes. During the transformation, no edges will be added or removed.
Hiro wants to color his toy using no more than colors, so that the toy will look different. If by transforming the toy it can become exactly the same color pattern, then the two colorings are considered essentially the same. Now Hiro wants to know how many essentially different colorings are possible.
Input Format
The first line contains three integers , representing the number of vertices, the number of edges, and the number of colors Hiro may use. The vertices are numbered from to .
The next lines each contain two integers , indicating that there is an edge between vertex and vertex . The input guarantees that there will not be two identical edges.
Output Format
Output one line indicating the number of essentially different coloring schemes. Since the number of schemes may be large, output the remainder of the answer modulo .
3 2 2
1 2
3 2
6
Hint
[Sample Explanation]
Let denote that the first vertex is colored , the second vertex is colored , and the third vertex is colored . Then the following colorings are essentially different: .
And is essentially the same as , and is essentially the same as .
[Constraints]
For of the testdata, , .
For of the testdata, , .
For of the testdata, , , .
Translated by ChatGPT 5