Unable to detect the error(november cookoff)

So this is thr first question of november cookoff 2018 truth and dare

My solution is

    #include <bits/stdc++.h>
using namespace std;

int main()
{
	int t;
	ios_base::sync_with_stdio(false);
	cin >> t;
	while (t--)
	{
		cin.tie(NULL);
		bool opa = false, opb = false;
		int tr, dr, ts, ds;
		set<int> ho, d;
		cin >> tr;
		for (int i = 0;i < tr;++i)
		{
			int inp;
			cin >> inp;
			if (ho.find(inp) == ho.end())
				ho.insert(inp);
		}
		cin >> dr;
		for (int i = 0;i < dr;++i)
		{
			int inp;
			cin >> inp;
			if (d.find(inp) == d.end())
				d.insert(inp);
		}
		cin >> ts;
		for (int i = 0;i < ts;++i)
		{
			int inp;
			cin >> inp;
			if (ho.find(inp) != ho.end())
				opa = true;
			else
			{
				opa = false;
				break;
			}
		}
		cin >> ds;
		for (int i = 0;i < ds;++i)
		{
			int inp;
			cin >> inp;
			if (d.find(inp) != d.end())
				opb = true;
			else
			{
				opb = false;
				break;
			}
		}
	

(opa && opb) ? cout << "yes" << endl : 
                  cout << "no" << endl;
	          }
	        return 0;
            }

But i am getting WA why?
Thank you in advance.

The problem is you are breaking as soon as the required condition meets. But you have not read the remaining input which will be read by the next loop or even next iteration.

Try removing the break statement from both the query loops as their are some unreaded inputs of query 1 going to the query 2.