You are given an acyclic, bidirectional graph with nodes and M edges. The nodes are numbered from to . You are given queries.
Query: Given colors, the colors are numbered fron to , you have to find the number of ways for coloring the graph by maintaining the following rules.
First line contains (), number of nodes and (), number of edges.
Next M lines contain two different integers and (), an edge between and .
Next line contains (), number of queries.
Next lines contain an integer (), number of colors.
For each query, print the number of ways for coloring the graph. You have to print the mod value with .
3 2 1 2 1 3 2 2 3