Roadworks
In the Republic of X, a two-party system has existed since ancient times. Each year, citizens with voting rights decide which party they trust more: the Party of Swindlers or the Party of Robbers. Throughout that year, all real power is concentrated in the hands of the chosen party.
Over the past M years, a fierce battle has emerged between the parties over the restructuring of the republic's road network to serve their interests. The Party of Swindlers aims to construct as many state roads as possible to siphon off more budget money for their "maintenance," while the Party of Robbers seeks to convert as many roads as possible into toll roads. All roads in the Republic of X allow two-way traffic.
It is known that during a year under the Swindlers' rule, they manage to build exactly one new road (initially free), and during a year under the Robbers' rule, they impose a toll on one of the currently free roads (in this case, the maintenance funds for this road are no longer drawn from the budget but from toll collections).
The president of the republic, currently lacking real political influence, decided to draw public attention to the road issue. He defined the road network as convenient (for ordinary citizens) if it is possible to travel from any city to any other using only free roads, while also ensuring that the number of free roads (and thus the budget funds for their maintenance, collected through taxes from the citizens) is as minimal as possible.
Your task is to write a program that determines whether the road network was convenient at the end of the i-th year of the "road war."
Input
The first line of the input contains two numbers: N (1 ≤ N ≤ 1000), the number of cities in the Republic of X, and M (1 ≤ M ≤ 100000), the duration of the prolonged "road war." The next M lines follow, each starting with a symbol: F if the Swindlers' party was in power that year, or R if the Robbers' party was in power, followed by two numbers - the city numbers u_i and v_i - representing a pair of cities between which the road became the focus of the respective party's attention (a new road was built if the Swindlers' party was in power, and one of the existing roads was made toll-based if the Robbers' party was in power). It is possible for there to be more than one road between two cities, or for a road to be built from a city to itself - who knows what the Swindlers' party might come up with.
It is guaranteed that the input data is correct, meaning all numbers u_i and v_i are within the range from 1 to N, and if it is known that in some year a road between two cities was made toll-based, it means that before the start of the year there was at least one free road between these cities.
Output
For each year, output on a separate line YES if the road network was convenient at the end of that year, and NO otherwise.