One day girls and boys come to Xi'an to look for a mate. Each girl has a value , each boy has a value . Girl and boy will fall in love only if .
Then queries follow. Ask you to calculate if we only have boys labeled from to , can we make all girls find their lovers?
输入格式
Several test cases (no more than ).
First line an integer . Indicates the number of test cases.
Then test cases follow. Each test case begins with three integers . The next line has integers indicating to . The next line has integers indicating to .
Then comes an integer . .
The next lines each contain two integers indicating each query.
输出格式
For each query, print "1" if we can make it or "0" otherwise.