The enemy of my enemy is my friend!#2359

The enemy of my enemy is my friend!

2 seconds
64 megabytes
Very easy

Winnie-the-Pooh has joined a new social network called InTheForest. On this platform, each user has a list of friends and a list of enemies. Users can add anyone to their enemy list, but there are specific rules:

  1. If user lists user as an enemy, it does not automatically mean that considers an enemy.

  2. A user cannot list themselves as an enemy.

Winnie-the-Pooh is fascinated by this social network. He spends his time tracking who becomes whose enemy, eager to understand the dynamics in their forest. He believes that no one would visit their enemy, and in his view, the enemy of an enemy is a friend. Therefore, he thinks that everyone should visit their friends. Winnie-the-Pooh is curious to find out how many friends user has. According to him, user is considered a friend of user if the following conditions are met:

  1. is an enemy of an enemy of .

  2. is not an enemy of .

Additionally, no user can be their own friend.

Input

The first line of the input contains two numbers, and (1 \leq n, m \leq 2000), representing the number of users on the social network and the number of queries, respectively.

The following lines contain queries of two types:

  1. — user has started considering user as an enemy.

  2. — determine the number of friends user has, according to Winnie-the-Pooh.

It is guaranteed that the input data is valid: a user will not consider themselves an enemy, and no user will be listed as an enemy more than once.

Output

For each query, output a single integer on a separate line, representing the answer.

Examples

Example 1

Loading
Loading