using System;

namespace ALDS1_4_C
{
    public abstract class Array<T>
    {
        protected T[] array;
        public int Count { get; protected set; }
        public Array(int capacity)
        {
            array = new T[capacity];
            Count = 0;
        }
        public Array(int capacity, T initValue)
        {
            array = new T[capacity];
            for (int i = 0; i < capacity; ++i) array[i] = initValue;
            Count = capacity;
        }

        public T this[int i] { get { return array[i]; } }
    }

    public class List<T> : Array<T>
    {
        public static int AUTOSIZE = 1024;
        public static int INCSIZE = 1024;

        private int capacity;
        private readonly int incSize;

        public List(int capacity, int incSize) : base(capacity)
        {
            this.capacity = capacity;
            this.incSize = incSize;
        }

        public bool Contains(T element)
        {
            foreach (var e in array) if (e.Equals(element)) return true;
            return false;
        }
        public void Add(T element)
        {
            CheckCapacity();
            array[Count++] = element;
        }

        protected void CheckCapacity()
        {
            if (Count == capacity)
            {
                var newArray = new T[capacity + incSize];
                array.CopyTo(newArray, 0);
                array = newArray;
                capacity += incSize;
            }
        }
    }
    public class HashSet<T> : Array<List<T>>
    {
        public static int AUTOSIZE = 1024;
        public static int DUPLICATESIZE = 2;

        private int capacity;

        public HashSet() : base(AUTOSIZE)
        {
            capacity = AUTOSIZE;
        }
        public HashSet(int capacity) : base(capacity)
        {
            this.capacity = capacity;
        }
        public HashSet(T[] array) : base(array.Length * 2 + 1)
        {
            foreach (var e in array) Add(e);
        }

        public bool Contains(T element)
        {
            var hash = element.GetHashCode() % capacity;
            if (hash < 0) hash = (hash + capacity) % capacity;
            if (array[hash] != null)
            {
                for (int i = 0; i < array[hash].Count; ++i) if (array[hash][i].Equals(element)) return true;
            }
            return false;
        }
        public void Add(T element)
        {
            CheckCapacity();
            var hash = element.GetHashCode() % capacity;
            if (hash < 0) hash = (hash + capacity) % capacity;
            if (array[hash] == null) array[hash] = new List<T>(DUPLICATESIZE, 1);
            array[hash].Add(element);
            Count++;
        }

        protected void CheckCapacity()
        {

        }
    }
    class Program
    {
        class DNA
        {
            public string text;
            public override int GetHashCode()
            {
                int sum = 0;
                foreach (var a in text)
                {
                    switch (a)
                    {
                        case 'A':sum += 0;break;
                        case 'T':sum += 1;break;
                        case 'C':sum += 2;break;
                        case 'G':sum += 3;break;
                    }
                    sum <<= 2;
                }
                return sum;
            }
            public override bool Equals(object obj)
            {
                return text.Equals((obj as DNA).text);
            }
        }
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            var set = new HashSet<DNA>(1<<24);
            while (n-- > 0)
            {
                var cmd = Console.ReadLine().Split(' ');
                if (cmd[0].Equals("insert")) set.Add(new DNA() { text = cmd[1] });
                else if (cmd[0].Equals("find")) Console.WriteLine(set.Contains(new DNA() { text = cmd[1] }) ? "yes" : "no");
            }
        }
    }
}

Measured memory_bytes: 269828