SP13808 COLOR_CC - Colors

Description

Given a Bipartite graph with N nodes, you have to colour each node in a way such that no two adjacent nodes have the same colour . Each node is allowed to choose colour from a subset of colours. print the possible number of ways. You are given a symmetric matrix i.e. matrix\[i\]\[j\] is always equal to matrix\[j\]\[i\] if matrix\[i\]\[j\]=='Y' then nodes i and j are connected by an edge matrix\[i\]\[j\]=='N' then nodes i and j are not connected

Input Format

T -number of test cases ( N test cases follow ) N -number of nodes in graph . N lines corresponding to matrix N line follows : each line contains xi -- total colours ith node can take , followed by i colours

Output Format

Print the possible number of ways to colour the graph T would be less than 20 0