$Dragon\ Ball\ Super$ has finished. As a fan of $Dragon\ Ball$, $Ctr$ couldn't forget any plot of it, especially the fighting scene of $Tournament\ of\ Power$(力量大会). People who participate in the $Tournament\ of\ Power$ will become the teammate with those who come from the same universe, even $Son\ Goku$ and $Frieza$.
There are $n$ people who may participate in the $Tournament\ of\ Power$, these people are numbered from $1$ to $n$. Also there are $m$ relations $(a_{i}, b_{i})$ which means person $a_{i}$ and person $b_{i}$ are come from the same universe.
$Ctr$ defines the $interest\ value$ of the $Tournament\ of\ Power$ is the number of different universes people, participate in $Tournament\ of\ Power$, come from.
Now, $Ctr$ has $q$ queries to ask you, each of which contains two integers: $l, r$. For each query you are required to tell him the $interest\ value$ when people ( $ l, l+1, ... , r$ ) participate in the $Tournament\ of\ Power$.