using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    const int M = 1046527;
    const int NUL = -1;
    const int L = 14;

    static char[,] h;


   
    static int GetChar(char ch)
    {
        if (ch == 'A')
        {
            return 1;
        }
        else if (ch == 'C')
        {
            return 2;
        }
        else if (ch == 'G')
        {
            return 3;
        }
        else if (ch == 'T')
        {
            return 4;
        }
        else
        {
            return 0;
        }
    }

   
    static long GetKey(char[] str)
    {
        long sum = 0;
        int p = 1;
        for (int i = 0; i < str.Length; i++)
        {
            sum += p * (GetChar(str[i]));
            p *= 5;
        }
        return sum;
    }

    
    static long H1(long key)
    {
        return key % M;
    }

    
    static long H2(long key)
    {
        return 1 + (key % (M - 1));
    }


    
    static bool Find(char[] str)
    {
        long key;
        long hashval;      
        key = GetKey(str);
        bool b;

        for (int i = 0; ; i++)
        {
            hashval = (H1(key) + i * H2(key)) % M;

            b = true;
            
            if (h[hashval, 0] == '\0')
            {
                return false;
            }
            else
            {
                int j;
                for(j = 0; j < str.Length; j++)
                {
                    if(h[hashval, j] != str[j])
                    {
                        b = false;
                    }
                }
                if(j == str.Length && h[hashval, j] != '\0')
                {
                    b = false;
                }             
            }

            if (!b)
            {
                continue;
            }
            else
            {
                return true;
            }
           
        }

    }

    
    static int Insert(char[] str)
    {
        long key;
        long hashval;
        key = GetKey(str);
        bool iseqal = true;

        for (int i = 0; ; i++)
        {
            hashval = (H1(key) + i * H2(key)) % M;   

            
            for (int j = 0; j < str.Length; j++)
            {
                if (h[hashval, j] != str[j])
                {
                    iseqal = false;
                    break;
                }
            }

            
            if (iseqal)
            {
                return 1;
            }

            
            else if (h[hashval, 0] == '\0')
            {
                for (int j = 0; j < str.Length; j++)
                {
                    h[hashval, j] = str[j];
                }
                return 0;
            }                     
        }

    }

    static void Main(string[] args)
    {
        h = new char[M, L];   

        
        for (int i = 0; i < M; i++)
        {
            h[i, 0] = '\0';
        }

        int n = int.Parse(Console.ReadLine());
        char[] order = new char[9];    
        char[] str = new char[L];     
        string[] input;
        for (int i = 0; i < n; i++)
        {
            input = Console.ReadLine().Split(' ');   
            order = input[0].ToArray();   
            str = input[1].ToArray();     

            
            if (order[0] == 'i')
            {
                Insert(str);               
            }
            
            else
            {
                if (Find(str))
                {
                    Console.WriteLine("yes");
                }
                else
                {
                    Console.WriteLine("no");
                }
            }

        }


    }

}


Measured memory_bytes: 53060