Grand Test

For each undirected graph, decide whether some pair of vertices admits three routes whose internal vertices and edges are all disjoint.

Medium7GraphDFSBinary searchImplementationNo attempts yetTime limit3sMemory limit512 MB

Problem

Jeremy, Richard and James like to test cars. Deciding where to run a test is always hard. They pick a country and look at its cities and the two-way roads between them.

A test needs two different cities SS and FF and three routes from SS to FF. A route is a sequence of cities v1,v2,,vkv_1, v_2, \dots, v_k with v1=Sv_1 = S, vk=Fv_k = F, and a road between viv_i and vi+1v_{i+1} for every ii with 1ik11 \le i \le k-1. No city appears twice inside one route.

The three routes must meet two conditions. Every city other than SS and FF appears in at most one of the three routes. No road is used by more than one route.

When such SS, FF and three routes exist, each of the three takes a car in SS, drives along one of the routes and tries to reach FF before the others.

You are given the description of several countries. For each country, decide whether two cities and three routes can be chosen this way.

Input

The first line contains the number of countries TT (1T1000001 \le T \le 100\,000). The descriptions of TT countries follow.

The first line of each country contains the number of cities nn and the number of roads mm (1n,m1000001 \le n, m \le 100\,000). The next mm lines contain the cities uiu_i and viv_i at the ends of a road (1ui<vin1 \le u_i < v_i \le n). All roads are two-way, and at most one road joins any pair of cities.

The sum of nn over all countries and the sum of mm over all countries are each at most 100000100\,000.

Output

For each country print one line. Print YES if two cities SS and FF and three routes meeting the conditions exist, and NO otherwise. Print the answers in the order the countries are given in the input.