CF223E Planar Graph

Description

A graph is called planar, if it can be drawn in such a way that its edges intersect only at their vertexes. An articulation point is such a vertex of an undirected graph, that when removed increases the number of connected components of the graph. A bridge is such an edge of an undirected graph, that when removed increases the number of connected components of the graph. You've got a connected undirected planar graph consisting of $ n $ vertexes, numbered from $ 1 $ to $ n $ , drawn on the plane. The graph has no bridges, articulation points, loops and multiple edges. You are also given $ q $ queries. Each query is a cycle in the graph. The query response is the number of graph vertexes, which (if you draw a graph and the cycle on the plane) are located either inside the cycle, or on it. Write a program that, given the graph and the queries, will answer each query.

Input Format

The first line contains two space-separated integers $ n $ and $ m $ ( $ 3

Output Format

For each query print a single integer — the number of vertexes inside the cycle or on it. Print the answers in the order, in which the queries follow in the input. Separate the numbers by spaces.