Your task is to take some chocolates from \(N\) different rooms. Each room contains \(P_i\) number of chocolates of the same or different brands. You are given an integer \(K\).
Write a program to determine whether you can visit each room and find \(K\) different brands of chocolates.
Input format
- First line: \(T\) denoting the number of test cases
- For each test case:
- First line: Two space-separated integers \(N\) and \(K\)
- Next \(N\) lines: An integer \(P\) followed by \(P\) space-separated strings denoting the brands of the chocolates
Output format
For each test case, print \(Yes\) or \(No\) depending upon the result.
Constraints
\(1 \leq T \leq 5\)
\(1 \leq N \leq 10^2 \)
\( 1 \leq K \leq 10^3 \)
\( 1 \leq P_i \leq 10^2 \)
\( 1 \leq \) Length of the strings \( \leq 10 \)
You can select two (\(K=2\)) distinct brands of chocolate. Therefore, 'Yes'.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor