# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

# Spam Me Not

Limits 1s, 512 MB

Your team has been tasked to build a section of a web app where users can choose whether and how they want to receive notifications. In this problem, you will have to implement a part of it.

In this app, each kind of notification is represented by an identifier. Identifiers are hierarchical. For example, a notification may be represented by the identifier email.group.new_invite. If a user wants to receive this notification, they will have to make sure each part of this hierarchical identifier is turned "on":

• email must be "on"
• email.group must be "on"
• email.group.new_invite must be "on"

In this example above, the identifier has 3 levels of hierarchy. An identifier will have at most 10 levels of hierarchy.

You will be given a series of commands and queries in the following format:

Command/QueryDescription
+ {u} {t}Turns on notification for user u for identifier t. For example, + 15 a.b.c turns on notification for user 15 for identifiers a.b.c, a.b, and a.
- {u} {t}Turns off notification for user u for identifier t. For example, - 35 x.y.z turns off notification for user 35 for identifiers x.y.z, x.y, and x.
? {u} {t}Print "Yes" if the user u would receive the notification for identifier t, otherwise "No".

## Input

The input begins with an integer $N$ ($0 < N ≤ 100000$). $N$ represents the number of commands/queries that follow.

You may assume that all commands/queries are valid. Users are represented with positive 32-bit signed integers and each identifier may be at most 50 characters long consisting of lowercase alphabets and dots.

## Output

For each query of type ? print the result in a line of its own.

## Sample

InputOutput
5
+ 15 email.newfriendrequest
- 15 email
+ 31 email.newfriendrequest
? 15 email.newfriendrequest
? 31 email.newfriendrequest
No
Yes

### Statistics

75% Solution Ratio

steinumEarliest, 11M ago

Sourav1234Fastest, 0.0s

steinumLightest, 131 kB

steinumShortest, 708B