import java.util.Iterator; import java.util.LinkedList; import java.util.Scanner; public class Main { public static void main(String[] args){ LinkedList[] ll = new LinkedList[26]; for(int x = 0;x<26;x++)ll[x] = new LinkedList(); Scanner sn = new Scanner(System.in); int n = sn.nextInt(); while((n--)!=0){ String s1 = sn.next(),s2 = sn.next(); if(s1.equals("insert")){ ll[s2.charAt(0)-'a'].offerFirst(s2); }else if(s1.equals("delete")){ int top = s2.charAt(0)-'a'; for(Iterator it = ll[top].iterator();it.hasNext();){ if(it.next().startsWith(s2)){ it.remove(); } } }else{ int top = s2.charAt(0)-'a'; boolean p = true; for(Iterator it = ll[top].iterator();it.hasNext();){ if(it.next().startsWith(s2)){ p=false; System.out.println("Yes");break; } } if(p)System.out.println("No"); } } sn.close(); } }