#include <stdio.h>
#include <string.h>

int find_s(long *str, long key, long n) {
  long j=0;
  str[n]=key;
  while (str[j]!=key) j++;
  if(j<n) return 1;
  return 0;
}

int find_b(long *S, long t, long n) {
  long s=0,e=n;
  while (s<e) {
    long m=(s+e)/2;
    if(S[m]==t)      return(m);
    else if (S[m]>t) e=m;
    else             s=m+1;
  }
  return(-1);
}

int insertionSort(long* A, long n, long g){
  int i,cnt=0;
  for (i=g;i<n;i++) {
    int k=A[i];
    int j=i-g;
    while((j>=0)&&(A[j]>k)) {
      A[j+g]=A[j];
      j-=g;
      cnt++;
      A[j+g]=k;
    }
  }
  return cnt;
}

void shellSort(long *A, long n){
  long G[100];
  long m,i,cnt=0;

  for(G[0]=1,m=0; (G[m]<=n) && (m<100); G[m+1]=G[m]*3+1, m++);
  cnt=0;
  for(i=m-1;i>=0;i--)
    cnt +=insertionSort(A,n,G[i]);
}


long encode(const char *key){
  int n=strlen(key),i;
  long sum=0;
  long keta=1;
  for(i=0;i<n;i++){
    if (key[i]=='A')      sum = sum + keta * 1;
    else if (key[i]=='C') sum = sum + keta * 2;
    else if (key[i]=='G') sum = sum + keta * 3;
    else if (key[i]=='T') sum = sum + keta * 4;
    keta=keta*5;
  }
  return (sum);
}
int main(void) {
  long n,i,s=0,Str[1000001];

  scanf("%ld\n",&n);
  for(i=0;i<n;i++){
    char cmd[8], str[14]; scanf("%s %s\n",cmd, str);
    if(cmd[0]=='i') {
      Str[s]=encode(str); s++;
    }
    else {
      shellSort(Str,s);
      if(find_b(Str,encode(str),s)>=0) printf("yes\n");
      else printf("no\n");
    }
  }
  return 0;
}