Preview:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define mod 1000000007
#define maxn 1000001
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define mem(a, val) memset(a, val, sizeof(a))
//===========================================================================================================================================================

ll vis[maxn],in[maxn],out[maxn],dis[maxn];
vector<ll> adj[maxn] ;
queue<ll> q ;

int main()
{
    fio;
    ll t=1;
    cin >> t;
    while (t--)
    { 	
      	ll n,k;
        cin>>n>>k;
 		
        for (ll i = 0; i <= n + 2; i++)
        {
            adj[i].clear();
            vis[i] = dis[i] = in[i] = out[i] = 0;
        }
        
        while(k--)
        {	
            ll x,y;
            cin>>x>>y; 
         	adj[x].pb(y);
            adj[y].pb(x);
        }
      	// traverse algo 
    }
    return 0;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter