#585. 「Nowcoder多校 2019 Day4」xor

「Nowcoder多校 2019 Day4」xor

当前没有测试数据。

题目描述

Your are given n sets.Every set contains some integers.

We say a set can express an integer, only when there exists a subset of the set such that the bitwise-xor of the elements in the subset is equal to that integer.

Now you need to answer m queries. Each query will give you three integers l,r,x and you should answer if for every i[l,r] i∈[l,r] ,the i-th set can express x.

输入格式

The first line contains two integers n,m.

For each of the following n lines, the first integer sz stands for the size of this set and the following sz integers stand for the elements in this set. The sets are described from number 1 to n.

For each of the following m lines, there're three integers l,r,x that means a query.

输出格式

For each query, output a line.

If for every i[l,r] i∈[l,r] ,the i-th set can express x, you need to print “YES”, and "NO" otherwise.

样例

样例输入

1 3
2 1 2
1 1 0
1 1 3
1 1 4

样例输出

YES
YES
NO

数据范围与提示

1≤n,m≤50000 ,1sz32 1≤sz≤32 1lrn 1≤l≤r≤n ,the every integer in input [0,232) [0,2^{32}) .