User ainta decided to make a new instant messenger called "aintalk". With aintalk, each user can chat with other people. User ainta made the prototype of some functions to implement this thing.
-
login(u): User u logins into aintalk and becomes online.
-
logout(u): User u logouts and becomes offline.
-
add_friend(u, v): User u and user v become friends. It means, u and v can talk with each other. The friendship is bidirectional.
-
del_friend(u, v): Unfriend user u and user v. It means, u and v cannot talk with each other from then.
-
count_online_friends(u): The function returns the number of friends of user u who are online at the moment.
Because the messenger is being tested by some users numbered from
1 to
n, there is no register method. This means, at the beginning, some users may be online, and some users may have friends.
User ainta is going to make these functions, but before making the messenger public, he wants to know whether he is correct. Help ainta verify his code.
Output
For each
count_online_friends(u) query, print the required answer in a single line.