Suffix path
In the ultra-secret laboratory known as "Kimod Yityased," a highly confidential device was developed. The syndicate "Black Sun" discovered that this device had a secret name: "Tamotva 173." Despite their best efforts, they couldn't decipher it using methods like the Caesar cipher, shifts, or RSA. In desperation, they turned to the Spring Humanitarian Kindergarten (SHK), another secretive organization that trains an elite squad of janitors. These janitors are experts at strategically placing trash, sweeping noisily, and dabbling in philosophy. Instantly, they realized that the name was a code for the device's main component. They also found out that the device can only handle files up to sixty megabytes.
Following this, the syndicate sought assistance from SHK's allies, the Weekly Geneva Breakfast (WGB). WGB, known for their expertise in ciphers, fence painting, floor washing, and modernization, declared that the device was their specialty, fitting perfectly with their ideology. Formally, the device can perform modernization, but only WGB can innovate, meaning the device can verify innovations but not create them. Inside the device is a string of lowercase Latin letters. Modernization involves adding a lowercase Latin letter to this string. WGB wanted to share more, but upon realizing SHK had miscalculated the maximum file size by a factor of thirty, they were too shocked to continue.
The syndicate then turned to their final allies: the Innovations and Cult of Line (ICL). ICL explained that a string is considered innovative for the device if it is a substring of the stored string. However, it soon became apparent that there was a catch. The best minds were stumped, trying everything from shouting to dancing, but to no avail. Finally, the directors of ICL, WGB, and SHK, along with a wet kitty, realized that the string must not only be a substring but also a prefix of the expanded stored string, consisting entirely of lowercase Latin letters. Satisfied with their discovery, they all went to sleep.
Reliable sources, specifically the Madagascar National Squad of Professional Super-agents (MNSP), revealed that whoever controls this device will wield unlimited power over the world. Your mission is clear: implement this device.
Input
The first line of the input contains the number M - the number of operations to be executed. The next M lines describe the operations: either "+ c" for modernization or "? s" for an innovation check. It is guaranteed that the device can process the input file.
Output
For each innovation check query, output YES if the string is innovative, and NO otherwise.