		import java.math.BigInteger;
		import java.util.ArrayList;
		import java.util.Arrays;
	import java.util.Collection;
	import java.util.Collections;
	import java.util.Comparator;
	import java.util.HashMap;
		import java.util.Iterator;
	import java.util.LinkedList;
	import java.util.List;
	import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
	import java.util.Scanner;
	import java.util.Set;
	import java.util.Stack;
	import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;
	import java.util.Scanner;
	import java.util.StringTokenizer;
	import java.util.TreeMap;
	import java.util.TreeSet;

		public class Main {

			static FastReader sc= new FastReader();
			static List<Integer> C;
			static List<Long> B;
		static	int mod=(int)Math.pow(10, 9)+7;

			public static void main(String[] args) {

				int n=sc.nextInt();
				C=new ArrayList<Integer>();
				HashMap<Integer,Long> map=new HashMap<>();
				HashMap<Integer,Integer> six=new HashMap<>();
				HashMap<Integer,Integer> two=new HashMap<>();
				HashMap<Integer,Integer> fours=new HashMap<>();
				HashMap<Integer,Integer> eight=new HashMap<>();

				for(int i=0;i<n;i++) {
					C.add(sc.nextInt());
					if(!map.containsKey(C.get(i)))map.put(C.get(i),1l);
					else map.put(C.get(i),map.get(C.get(i))+1);
				}
				for(HashMap.Entry<Integer, Long> i:map.entrySet()) {

						if(i.getValue()>=6)six.put(i.getKey(),1);
						if(i.getValue()>=2)two.put(i.getKey(),1);
						if(i.getValue()>=4)fours.put(i.getKey(),1);
						if(i.getValue()>=8)eight.put(i.getKey(),1);
						}

				int m=sc.nextInt();
				while(m-->0) {
					String q=sc.next();
				//	System.out.println(q);
					int val=sc.nextInt();
					//int val=Integer.parseInt(q.substring(1,q.length()));
					if(q.charAt(0)=='-') {

						if(map.containsKey(val)) {
							map.put(val, map.get(val)-1);
						}
						if(six.containsKey(val)&&map.get(val)<6)six.remove(val);
						if(two.containsKey(val)&&map.get(val)<2)two.remove(val);
						if(fours.containsKey(val)&&map.get(val)<4)fours.remove(val);
						if(eight.containsKey(val)&&map.get(val)<8)eight.remove(val);

					}
					if(q.charAt(0)=='+') {

						if(map.containsKey(val)) {
							map.put(val, map.get(val)+1);
						}
						else map.put(val, 1l);
						if(map.get(val)>=6)six.put(val,1);
						if(map.get(val)>=2)two.put(val,1);
						if(map.get(val)>=4)fours.put(val,1);
						if(map.get(val)>=8)eight.put(val,1);

					}
					//System.out.println(map);
					if(eight.size()>=1) {System.out.println("YES");continue;}
					if(fours.size()>=2) {System.out.println("YES");continue;}
					if(six.size()>=1&&two.size()>=2)System.out.println("YES");
					else if(fours.size()>=1&&two.size()>=3)System.out.println("YES");
					else System.out.println("NO");

				}

			}

			static boolean isSubsetSum(int set[],  int n, int sum)
	{
	// The value of subset[i][j] will be
	// true if there is a subset of
	// set[0..j-1] with sum equal to i
	boolean subset[][] = new boolean[sum + 1][n + 1];

	// If sum is 0, then answer is true
	for (int i = 0; i <= n; i++)
	subset[0][i] = true;

	// If sum is not 0 and set is empty,
	// then answer is false
	for (int i = 1; i <= sum; i++)
	subset[i][0] = false;

	// Fill the subset table in botton
	// up manner
	for (int i = 1; i <= sum; i++) {
	for (int j = 1; j <= n; j++) {
	    subset[i][j] = subset[i][j - 1];
	    if (i >= set[j - 1])
	        subset[i][j] = subset[i][j]
	                       || subset[i - set[j - 1]][j - 1];
	}
	}

	return subset[sum][n];
	}

			static boolean search(ArrayList<Integer> a,int m,int h) {
				PriorityQueue<Integer> p=new PriorityQueue<Integer>(new Comparator<Integer>() {
						@Override
						public int compare(Integer o1, Integer o2) {
							// TODO Auto-generated method stub
							return o2-o1;
						}
				});

				for(int i=0;i<m;i++) {
					p.add(a.get(i));
				}
				int c=0;
				//System.out.println(p);
				while(!p.isEmpty()) {
					//System.out.println(p);

					h-=p.poll();
					if(h<0)break;

					c++;

				//	System.out.println(h+" "+p+" "+c+" "+m);

					if(!p.isEmpty()) {
					p.poll();
					c++;}

				}
			//	System.out.println(c!=m);
				if(c!=m)return false;

				return true;
			}
		//	static int  key=-1;

			static boolean isPowerOfTwo(long n)
		    {
		        if (n == 0)
		            return false;

		        while (n != 1)
		        {
		            if (n % 2 != 0)
		                return false;
		            n = n / 2;
		        }
		        return true;
		    }

			 static boolean isPerfectSquare(double x)
			    {

			        // Find floating point value of
			        // square root of x.
			        double sr = Math.sqrt(x);

			        // If square root is an integer
			        return ((sr - Math.floor(sr)) == 0);
			    }

		static	int binarySearch(ArrayList<Long> arr, int l, int r, long x,int key)
		    {
		        if (r >= l) {
		            int mid =  (r + l) / 2;
		//  if(mid>=arr.size())return -1;
		            // If the element is present at the
		            // middle itself

		            if (arr.get(mid) == x)
		                return mid+1;

		            // If element is smaller than mid, then
		            // it can only be present in left subarray
		            if (arr.get(mid) > x) {
		                return binarySearch(arr, l, mid - 1, x,key);
		            }
		            // Else the element can only be present
		            // in right subarray
		            key=mid+1;
		            return binarySearch(arr, mid + 1, r, x,key);
		        }

		        // We reach here when element is not present
		        // in array
		        return key;
		    }

		    static boolean isPrime(long n)
		    {
		        // Corner cases
		        if (n <= 1)
		            return false;
		        if (n <= 3)
		            return true;

		        // This is checked so that we can skip
		        // middle five numbers in below loop
		        if (n % 2 == 0 || n % 3 == 0)
		            return false;

		        for (int i = 5; i * i <= n; i = i + 6)
		            if (n % i == 0 || n % (i + 2) == 0)
		                return false;

		        return true;
		    }

		    static class FastReader
		    {
		        BufferedReader br;
		        StringTokenizer st;

		        public FastReader()
		        {
		            br = new BufferedReader(new
		                     InputStreamReader(System.in));
		        }

		        String next()
		        {
		            while (st == null || !st.hasMoreElements())
		            {
		                try
		                {
		                    st = new StringTokenizer(br.readLine());
		                }
		                catch (IOException  e)
		                {
		                    e.printStackTrace();
		                }
		            }
		            return st.nextToken();
		        }

		        int nextInt()
		        {
		            return Integer.parseInt(next());
		        }

		        long nextLong()
		        {
		            return Long.parseLong(next());
		        }

		        double nextDouble()
		        {
		            return Double.parseDouble(next());
		        }

		        String nextLine()
		        {
		            String str = "";
		            try
		            {
		                str = br.readLine();
		            }
		            catch (IOException e)
		            {
		                e.printStackTrace();
		            }
		            return str;
		        }
		    }

		}

		class Sol {

			int value;int in;int i;
			Sol(int value,int in,int i){
				this.value=value;
				this.in=in;
				this.i=i;
			}

	}

 class SegmentTree {

	SegNode st[];
	int n;
//	long arr[];
	public SegmentTree(int n) {
			this.n=n;
		//this.arr=arr;
		st=new SegNode[4*n];

	}

	void init(long n) {

		for(int i=0;i<4*n;i++) {
			st[i]=new SegNode();
		}

	}

	void set(int i,long v,int x,int lx,int rx) {

		if(rx-lx==1) {
			st[x].sum=v;
			st[x].max=v;
			return ;
		}
		int m=lx+(rx-lx)/2;
		if(i<m) set(i,v,2*x+1,lx,m);
		else set(i,v,2*x+2,m,rx);

		st[x].sum=st[2*x+1].sum+st[2*x+2].sum;
		long ma=Math.max(st[2*x+1].max,st[2*x+2].max);
			st[x].max=Math.max(ma,st[x].sum);
	}

	void set (int i,long v) {
		set(i,v,0,0,n);
	}

	long max=Integer.MIN_VALUE;
long sum(int l,int r,int x,int lx,int rx) {
	if(lx>=r||l>=rx)return 0;
	if(lx>=l||rx<=r)return st[x].sum;

		int m=(rx+lx)/2;

		long s1=sum(l,r,2*x+1,lx,m);
		long s2=sum(l,r,2*x+2,m,rx);

		return max= Math.max(Math.max(Math.max(s1,s2),s1+s2),max);

	}
	long sum(int l,int r) {
		return sum(l,r,0,0,n);
	}

}
	class SegNode{
		long max;long sum;
		public SegNode() {
			// TODO Auto-generated constructor stub
			sum=0;
			max=Integer.MIN_VALUE;

		}
	}


		import java.math.BigInteger;
		import java.util.ArrayList;
		import java.util.Arrays;
	import java.util.Collection;
	import java.util.Collections;
	import java.util.Comparator;
	import java.util.HashMap;
		import java.util.Iterator;
	import java.util.LinkedList;
	import java.util.List;
	import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
	import java.util.Scanner;
	import java.util.Set;
	import java.util.Stack;
	import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;
	import java.util.Scanner;
	import java.util.StringTokenizer;
	import java.util.TreeMap;
	import java.util.TreeSet;

		public class Main {

			static FastReader sc= new FastReader();
			static List<Integer> C;
			static List<Long> B;
		static	int mod=(int)Math.pow(10, 9)+7;

			public static void main(String[] args) {

				int n=sc.nextInt();
				C=new ArrayList<Integer>();
				HashMap<Integer,Integer> map=new HashMap<>();
				HashMap<Integer,Integer> six=new HashMap<>();
				HashMap<Integer,Integer> two=new HashMap<>();
				HashMap<Integer,Integer> fours=new HashMap<>();

				for(int i=0;i<n;i++) {
					C.add(sc.nextInt());
					if(!map.containsKey(C.get(i)))map.put(C.get(i),1);
					else map.put(C.get(i),map.get(C.get(i))+1);
				}
				for(HashMap.Entry<Integer, Integer> i:map.entrySet()) {

						if(i.getValue()>=6)six.put(i.getKey(),1);
						if(i.getValue()>=2)six.put(i.getKey(),1);
						if(i.getValue()>=4)fours.put(i.getKey(),1);
						}

				int m=sc.nextInt();
				while(m-->0) {
					String q=sc.next();
				//	System.out.println(q);
					int val=sc.nextInt();
					//int val=Integer.parseInt(q.substring(1,q.length()));
					if(q.charAt(0)=='-') {

						if(map.containsKey(val)) {
							map.put(val, map.get(val)-1);
						}
						if(six.containsKey(val)&&map.get(val)<6)six.remove(val);
						if(two.containsKey(val)&&map.get(val)<2)two.remove(val);
						if(fours.containsKey(val)&&map.get(val)<4)fours.remove(val);

					}
					if(q.charAt(0)=='+') {

						if(map.containsKey(val)) {
							map.put(val, map.get(val)+1);
						}
						else map.put(val, 1);
						if(map.get(val)>=6)six.put(val,1);
						if(map.get(val)>=2)two.put(val,1);
						if(map.get(val)>=4)fours.put(val,1);
					}
					//System.out.println(map);

					if(fours.size()>=2) {System.out.println("YES");continue;}
					if(six.size()>=1&&two.size()>=2)System.out.println("YES");
					else System.out.println("NO");

				}

			}

			static boolean isSubsetSum(int set[],  int n, int sum)
	{
	// The value of subset[i][j] will be
	// true if there is a subset of
	// set[0..j-1] with sum equal to i
	boolean subset[][] = new boolean[sum + 1][n + 1];

	// If sum is 0, then answer is true
	for (int i = 0; i <= n; i++)
	subset[0][i] = true;

	// If sum is not 0 and set is empty,
	// then answer is false
	for (int i = 1; i <= sum; i++)
	subset[i][0] = false;

	// Fill the subset table in botton
	// up manner
	for (int i = 1; i <= sum; i++) {
	for (int j = 1; j <= n; j++) {
	    subset[i][j] = subset[i][j - 1];
	    if (i >= set[j - 1])
	        subset[i][j] = subset[i][j]
	                       || subset[i - set[j - 1]][j - 1];
	}
	}

	return subset[sum][n];
	}

			static boolean search(ArrayList<Integer> a,int m,int h) {
				PriorityQueue<Integer> p=new PriorityQueue<Integer>(new Comparator<Integer>() {
						@Override
						public int compare(Integer o1, Integer o2) {
							// TODO Auto-generated method stub
							return o2-o1;
						}
				});

				for(int i=0;i<m;i++) {
					p.add(a.get(i));
				}
				int c=0;
				//System.out.println(p);
				while(!p.isEmpty()) {
					//System.out.println(p);

					h-=p.poll();
					if(h<0)break;

					c++;

				//	System.out.println(h+" "+p+" "+c+" "+m);

					if(!p.isEmpty()) {
					p.poll();
					c++;}

				}
			//	System.out.println(c!=m);
				if(c!=m)return false;

				return true;
			}
		//	static int  key=-1;

			static boolean isPowerOfTwo(long n)
		    {
		        if (n == 0)
		            return false;

		        while (n != 1)
		        {
		            if (n % 2 != 0)
		                return false;
		            n = n / 2;
		        }
		        return true;
		    }

			 static boolean isPerfectSquare(double x)
			    {

			        // Find floating point value of
			        // square root of x.
			        double sr = Math.sqrt(x);

			        // If square root is an integer
			        return ((sr - Math.floor(sr)) == 0);
			    }

		static	int binarySearch(ArrayList<Long> arr, int l, int r, long x,int key)
		    {
		        if (r >= l) {
		            int mid =  (r + l) / 2;
		//  if(mid>=arr.size())return -1;
		            // If the element is present at the
		            // middle itself

		            if (arr.get(mid) == x)
		                return mid+1;

		            // If element is smaller than mid, then
		            // it can only be present in left subarray
		            if (arr.get(mid) > x) {
		                return binarySearch(arr, l, mid - 1, x,key);
		            }
		            // Else the element can only be present
		            // in right subarray
		            key=mid+1;
		            return binarySearch(arr, mid + 1, r, x,key);
		        }

		        // We reach here when element is not present
		        // in array
		        return key;
		    }

		    static boolean isPrime(long n)
		    {
		        // Corner cases
		        if (n <= 1)
		            return false;
		        if (n <= 3)
		            return true;

		        // This is checked so that we can skip
		        // middle five numbers in below loop
		        if (n % 2 == 0 || n % 3 == 0)
		            return false;

		        for (int i = 5; i * i <= n; i = i + 6)
		            if (n % i == 0 || n % (i + 2) == 0)
		                return false;

		        return true;
		    }

		    static class FastReader
		    {
		        BufferedReader br;
		        StringTokenizer st;

		        public FastReader()
		        {
		            br = new BufferedReader(new
		                     InputStreamReader(System.in));
		        }

		        String next()
		        {
		            while (st == null || !st.hasMoreElements())
		            {
		                try
		                {
		                    st = new StringTokenizer(br.readLine());
		                }
		                catch (IOException  e)
		                {
		                    e.printStackTrace();
		                }
		            }
		            return st.nextToken();
		        }

		        int nextInt()
		        {
		            return Integer.parseInt(next());
		        }

		        long nextLong()
		        {
		            return Long.parseLong(next());
		        }

		        double nextDouble()
		        {
		            return Double.parseDouble(next());
		        }

		        String nextLine()
		        {
		            String str = "";
		            try
		            {
		                str = br.readLine();
		            }
		            catch (IOException e)
		            {
		                e.printStackTrace();
		            }
		            return str;
		        }
		    }

		}

		class Sol {

			int value;int in;int i;
			Sol(int value,int in,int i){
				this.value=value;
				this.in=in;
				this.i=i;
			}

	}

 class SegmentTree {

	SegNode st[];
	int n;
//	long arr[];
	public SegmentTree(int n) {
			this.n=n;
		//this.arr=arr;
		st=new SegNode[4*n];

	}

	void init(long n) {

		for(int i=0;i<4*n;i++) {
			st[i]=new SegNode();
		}

	}

	void set(int i,long v,int x,int lx,int rx) {

		if(rx-lx==1) {
			st[x].sum=v;
			st[x].max=v;
			return ;
		}
		int m=lx+(rx-lx)/2;
		if(i<m) set(i,v,2*x+1,lx,m);
		else set(i,v,2*x+2,m,rx);

		st[x].sum=st[2*x+1].sum+st[2*x+2].sum;
		long ma=Math.max(st[2*x+1].max,st[2*x+2].max);
			st[x].max=Math.max(ma,st[x].sum);
	}

	void set (int i,long v) {
		set(i,v,0,0,n);
	}

	long max=Integer.MIN_VALUE;
long sum(int l,int r,int x,int lx,int rx) {
	if(lx>=r||l>=rx)return 0;
	if(lx>=l||rx<=r)return st[x].sum;

		int m=(rx+lx)/2;

		long s1=sum(l,r,2*x+1,lx,m);
		long s2=sum(l,r,2*x+2,m,rx);

		return max= Math.max(Math.max(Math.max(s1,s2),s1+s2),max);

	}
	long sum(int l,int r) {
		return sum(l,r,0,0,n);
	}

}
	class SegNode{
		long max;long sum;
		public SegNode() {
			// TODO Auto-generated constructor stub
			sum=0;
			max=Integer.MIN_VALUE;

		}
	}


		import java.math.BigInteger;
		import java.util.ArrayList;
		import java.util.Arrays;
	import java.util.Collection;
	import java.util.Collections;
	import java.util.Comparator;
	import java.util.HashMap;
		import java.util.Iterator;
	import java.util.LinkedList;
	import java.util.List;
	import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
	import java.util.Scanner;
	import java.util.Set;
	import java.util.Stack;
	import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;
	import java.util.Scanner;
	import java.util.StringTokenizer;
	import java.util.TreeMap;
	import java.util.TreeSet;

		public class Main {

			static FastReader sc= new FastReader();
			static List<Integer> C;
			static List<Long> B;
		static	int mod=(int)Math.pow(10, 9)+7;

			public static void main(String[] args) {

				int n=sc.nextInt();
				C=new ArrayList<Integer>();
				HashMap<Integer,Integer> map=new HashMap<>();
				HashMap<Integer,Integer> six=new HashMap<>();
				HashMap<Integer,Integer> two=new HashMap<>();
				HashMap<Integer,Integer> fours=new HashMap<>();

				for(int i=0;i<n;i++) {
					C.add(sc.nextInt());
					if(!map.containsKey(C.get(i)))map.put(C.get(i),1);
					else map.put(C.get(i),map.get(C.get(i))+1);
				}
				for(HashMap.Entry<Integer, Integer> i:map.entrySet()) {

						if(i.getValue()>=6)six.put(i.getKey(),1);
						if(i.getValue()>=2)six.put(i.getKey(),1);
						if(i.getValue()>=4)fours.put(i.getKey(),1);
						}

				int m=sc.nextInt();
				while(m-->0) {
					String q=sc.next();
				//	System.out.println(q);
					int val=sc.nextInt();
					//int val=Integer.parseInt(q.substring(1,q.length()));
					if(q.charAt(0)=='-') {

						if(map.containsKey(val)) {
							map.put(val, map.get(val)-1);
						}
						if(six.containsKey(val)&&map.get(val)<6)six.remove(val);
						if(two.containsKey(val)&&map.get(val)<2)two.remove(val);
						if(fours.containsKey(val)&&map.get(val)<4)fours.remove(val);

					}
					if(q.charAt(0)=='+') {

						if(map.containsKey(val)) {
							map.put(val, map.get(val)+1);
						}
						else map.put(val, 1);
						if(map.get(val)>=6)six.put(val,1);
						if(map.get(val)>=2)two.put(val,1);
						if(map.get(val)>=4)fours.put(val,1);
					}
					//System.out.println(map);

					if(fours.size()>=2) {System.out.println("YES");continue;}
					if(six.size()>=1&&two.size()>=2)System.out.println("YES");
					else if(fours.size()>=1&&two.size()>=3)System.out.println("YES");
					else System.out.println("NO");

				}

			}

			static boolean isSubsetSum(int set[],  int n, int sum)
	{
	// The value of subset[i][j] will be
	// true if there is a subset of
	// set[0..j-1] with sum equal to i
	boolean subset[][] = new boolean[sum + 1][n + 1];

	// If sum is 0, then answer is true
	for (int i = 0; i <= n; i++)
	subset[0][i] = true;

	// If sum is not 0 and set is empty,
	// then answer is false
	for (int i = 1; i <= sum; i++)
	subset[i][0] = false;

	// Fill the subset table in botton
	// up manner
	for (int i = 1; i <= sum; i++) {
	for (int j = 1; j <= n; j++) {
	    subset[i][j] = subset[i][j - 1];
	    if (i >= set[j - 1])
	        subset[i][j] = subset[i][j]
	                       || subset[i - set[j - 1]][j - 1];
	}
	}

	return subset[sum][n];
	}

			static boolean search(ArrayList<Integer> a,int m,int h) {
				PriorityQueue<Integer> p=new PriorityQueue<Integer>(new Comparator<Integer>() {
						@Override
						public int compare(Integer o1, Integer o2) {
							// TODO Auto-generated method stub
							return o2-o1;
						}
				});

				for(int i=0;i<m;i++) {
					p.add(a.get(i));
				}
				int c=0;
				//System.out.println(p);
				while(!p.isEmpty()) {
					//System.out.println(p);

					h-=p.poll();
					if(h<0)break;

					c++;

				//	System.out.println(h+" "+p+" "+c+" "+m);

					if(!p.isEmpty()) {
					p.poll();
					c++;}

				}
			//	System.out.println(c!=m);
				if(c!=m)return false;

				return true;
			}
		//	static int  key=-1;

			static boolean isPowerOfTwo(long n)
		    {
		        if (n == 0)
		            return false;

		        while (n != 1)
		        {
		            if (n % 2 != 0)
		                return false;
		            n = n / 2;
		        }
		        return true;
		    }

			 static boolean isPerfectSquare(double x)
			    {

			        // Find floating point value of
			        // square root of x.
			        double sr = Math.sqrt(x);

			        // If square root is an integer
			        return ((sr - Math.floor(sr)) == 0);
			    }

		static	int binarySearch(ArrayList<Long> arr, int l, int r, long x,int key)
		    {
		        if (r >= l) {
		            int mid =  (r + l) / 2;
		//  if(mid>=arr.size())return -1;
		            // If the element is present at the
		            // middle itself

		            if (arr.get(mid) == x)
		                return mid+1;

		            // If element is smaller than mid, then
		            // it can only be present in left subarray
		            if (arr.get(mid) > x) {
		                return binarySearch(arr, l, mid - 1, x,key);
		            }
		            // Else the element can only be present
		            // in right subarray
		            key=mid+1;
		            return binarySearch(arr, mid + 1, r, x,key);
		        }

		        // We reach here when element is not present
		        // in array
		        return key;
		    }

		    static boolean isPrime(long n)
		    {
		        // Corner cases
		        if (n <= 1)
		            return false;
		        if (n <= 3)
		            return true;

		        // This is checked so that we can skip
		        // middle five numbers in below loop
		        if (n % 2 == 0 || n % 3 == 0)
		            return false;

		        for (int i = 5; i * i <= n; i = i + 6)
		            if (n % i == 0 || n % (i + 2) == 0)
		                return false;

		        return true;
		    }

		    static class FastReader
		    {
		        BufferedReader br;
		        StringTokenizer st;

		        public FastReader()
		        {
		            br = new BufferedReader(new
		                     InputStreamReader(System.in));
		        }

		        String next()
		        {
		            while (st == null || !st.hasMoreElements())
		            {
		                try
		                {
		                    st = new StringTokenizer(br.readLine());
		                }
		                catch (IOException  e)
		                {
		                    e.printStackTrace();
		                }
		            }
		            return st.nextToken();
		        }

		        int nextInt()
		        {
		            return Integer.parseInt(next());
		        }

		        long nextLong()
		        {
		            return Long.parseLong(next());
		        }

		        double nextDouble()
		        {
		            return Double.parseDouble(next());
		        }

		        String nextLine()
		        {
		            String str = "";
		            try
		            {
		                str = br.readLine();
		            }
		            catch (IOException e)
		            {
		                e.printStackTrace();
		            }
		            return str;
		        }
		    }

		}

		class Sol {

			int value;int in;int i;
			Sol(int value,int in,int i){
				this.value=value;
				this.in=in;
				this.i=i;
			}

	}

 class SegmentTree {

	SegNode st[];
	int n;
//	long arr[];
	public SegmentTree(int n) {
			this.n=n;
		//this.arr=arr;
		st=new SegNode[4*n];

	}

	void init(long n) {

		for(int i=0;i<4*n;i++) {
			st[i]=new SegNode();
		}

	}

	void set(int i,long v,int x,int lx,int rx) {

		if(rx-lx==1) {
			st[x].sum=v;
			st[x].max=v;
			return ;
		}
		int m=lx+(rx-lx)/2;
		if(i<m) set(i,v,2*x+1,lx,m);
		else set(i,v,2*x+2,m,rx);

		st[x].sum=st[2*x+1].sum+st[2*x+2].sum;
		long ma=Math.max(st[2*x+1].max,st[2*x+2].max);
			st[x].max=Math.max(ma,st[x].sum);
	}

	void set (int i,long v) {
		set(i,v,0,0,n);
	}

	long max=Integer.MIN_VALUE;
long sum(int l,int r,int x,int lx,int rx) {
	if(lx>=r||l>=rx)return 0;
	if(lx>=l||rx<=r)return st[x].sum;

		int m=(rx+lx)/2;

		long s1=sum(l,r,2*x+1,lx,m);
		long s2=sum(l,r,2*x+2,m,rx);

		return max= Math.max(Math.max(Math.max(s1,s2),s1+s2),max);

	}
	long sum(int l,int r) {
		return sum(l,r,0,0,n);
	}

}
	class SegNode{
		long max;long sum;
		public SegNode() {
			// TODO Auto-generated constructor stub
			sum=0;
			max=Integer.MIN_VALUE;

		}
	}


import java.util.*;
import java.io.*;
import java.lang.*;

public class Main{
   static class FastReader{
         BufferedReader br;
         StringTokenizer st;
         public FastReader()throws IOException{
          br=new BufferedReader(new InputStreamReader(System.in));
         }
         public FastReader(String s)throws IOException{
          br=new BufferedReader(new FileReader(new File(s)));
         }
         String next(){
           while(st==null || !st.hasMoreElements()){
             try{
                st=new StringTokenizer(br.readLine());
             }
             catch(Exception e){
               e.printStackTrace();
             }
           }
           return st.nextToken();
         }
         String nextLing(){
            String str="";
            try{
              str=br.readLine();
                 }
             catch(Exception e){
               e.printStackTrace();
             }
             return str;
         }
         int nextInt(){
         return Integer.parseInt(next());
         }
         long nextLong(){
          return Long.parseLong(next());
         }
         double nextDouble(){
          return Double.parseDouble(next());
         }

   }
   public static void main(String args[])throws IOException{
      FastReader in=new FastReader();
      int n=in.nextInt();
       HashMap<Integer,Integer>hmap=new HashMap<>();
       int cnt2=0,cnt4=0;
          for(int i=0;i<n;i++){
             int next=in.nextInt();
             hmap.put(next,hmap.getOrDefault(next,0)+1);
             if(hmap.get(next)%2==0)
                 cnt2++;
             if(hmap.get(next)%4==0)
                 cnt4++;
                }
             int q=in.nextInt();
             while(q-->0){
               String c=in.next();
               int curr=in.nextInt();
               if(c.equals("+")){
                  hmap.put(curr,hmap.getOrDefault(curr,0)+1);
                    if(hmap.get(curr)%2==0)
                        cnt2++;
                    if(hmap.get(curr)%4==0)
                       cnt4++;
                   }
                  if(c.equals("-")){
                          if(hmap.get(curr)%4==0){
                            cnt4--;
                          }
                        if(hmap.get(curr)%2==0){
                            cnt2--;

                        }
                        hmap.put(curr,hmap.get(curr)-1);
                  }
                  if(cnt4>=1 && cnt2>=4)
                     System.out.println("YES");
                  else
                    System.out.println("NO");

             }

   }

}


import java.util.*;
import java.io.*;
import java.lang.*;

public class Main{
   static class FastReader{
         BufferedReader br;
         StringTokenizer st;
         public FastReader()throws IOException{
          br=new BufferedReader(new InputStreamReader(System.in));
         }
         public FastReader(String s)throws IOException{
          br=new BufferedReader(new FileReader(new File(s)));
         }
         String next(){
           while(st==null || !st.hasMoreElements()){
             try{
                st=new StringTokenizer(br.readLine());
             }
             catch(Exception e){
               e.printStackTrace();
             }
           }
           return st.nextToken();
         }
         String nextLing(){
            String str="";
            try{
              str=br.readLine();
                 }
             catch(Exception e){
               e.printStackTrace();
             }
             return str;
         }
         int nextInt(){
         return Integer.parseInt(next());
         }
         long nextLong(){
          return Long.parseLong(next());
         }
         double nextDouble(){
          return Double.parseDouble(next());
         }

   }
   public static void main(String args[])throws IOException{
       FastReader in=new FastReader();
       int n=in.nextInt();
       HashMap<Integer,Integer>map=new HashMap<Integer,Integer>();
       for(int i=0;i<n;i++){
          int x=in.nextInt();
             if(map.containsKey(x)){
               int v=map.get(x);
               map.put(x,v+1);
             }
             else
                map.put(x,1);
           }
         int Q=in.nextInt();
         while(Q-->0){
              char c=in.next().charAt(0); int x=in.nextInt();
              int v=0;
              if(map.containsKey(x))
                v=map.get(x);
              if(c=='+')
                map.put(x,v+1);
              else
                map.put(x,v-1);
             boolean sq=false,rec=false,side1=false,side2=false;
             for(Map.Entry m:map.entrySet()){
                int value=(int)m.getValue();
                if(value>=8){sq=true; rec=true; break;}
               else if(value>=4){
                if(!sq){
                  sq=true;
                  if(value-4>=2){
                  if(!side1)
                    side1=true;
                  else{ side2=true; rec=true; break;}
                      }
                  }
                else{
                  rec=true; break;
                }
                }
              else if(value>=2){
                if(!side1)
                  side1=true;
               else{ side2=true; rec=true;}

              }

             }
             if(rec==true &&  sq==true)
               System.out.println("YES");
             else
              System.out.println("NO");

         }

   }

}


import java.util.*;
import java.io.*;
import java.lang.*;

public class Main{
   static class FastReader{
         BufferedReader br;
         StringTokenizer st;
         public FastReader()throws IOException{
          br=new BufferedReader(new InputStreamReader(System.in));
         }
         public FastReader(String s)throws IOException{
          br=new BufferedReader(new FileReader(new File(s)));
         }
         String next(){
           while(st==null || !st.hasMoreElements()){
             try{
                st=new StringTokenizer(br.readLine());
             }
             catch(Exception e){
               e.printStackTrace();
             }
           }
           return st.nextToken();
         }
         String nextLing(){
            String str="";
            try{
              str=br.readLine();
                 }
             catch(Exception e){
               e.printStackTrace();
             }
             return str;
         }
         int nextInt(){
         return Integer.parseInt(next());
         }
         long nextLong(){
          return Long.parseLong(next());
         }
         double nextDouble(){
          return Double.parseDouble(next());
         }

   }
   public static void main(String args[])throws IOException{
       FastReader in=new FastReader();
       int n=in.nextInt();
       int a[]=new int[100001];
       Arrays.fill(a,0);
       for(int i=0;i<n;i++){
           int x=in.nextInt();
           a[x]++;
           }
         int Q=in.nextInt();
         while(Q-->0){
              char c=in.next().charAt(0); int x=in.nextInt();
              if(c=='+')
                a[x]++;
              else
                a[x]--;
             boolean sq=false,rec=false,side1=false,side2=false;
             for(int i=1;i<=100000;i++){
                int value=a[i];
                if(value>=8){sq=true; rec=true; break;}
               else if(value>=4){
                if(!sq){
                  sq=true;
                  if(value-4>=2){
                  if(!side1)
                    side1=true;
                  else{ side2=true; rec=true; break;}
                      }
                  }
                else{
                  rec=true; break;
                }
                }
              else if(value>=2){
                if(!side1)
                  side1=true;
               else{ side2=true; rec=true;}

              }

             }
             if(rec==true &&  sq==true)
               System.out.println("YES");
             else
              System.out.println("NO");

         }

   }

}


import java.util.*;
import java.io.*;
import java.lang.*;

public class Main{
   static class FastReader{
         BufferedReader br;
         StringTokenizer st;
         public FastReader()throws IOException{
          br=new BufferedReader(new InputStreamReader(System.in));
         }
         public FastReader(String s)throws IOException{
          br=new BufferedReader(new FileReader(new File(s)));
         }
         String next(){
           while(st==null || !st.hasMoreElements()){
             try{
                st=new StringTokenizer(br.readLine());
             }
             catch(Exception e){
               e.printStackTrace();
             }
           }
           return st.nextToken();
         }
         String nextLing(){
            String str="";
            try{
              str=br.readLine();
                 }
             catch(Exception e){
               e.printStackTrace();
             }
             return str;
         }
         int nextInt(){
         return Integer.parseInt(next());
         }
         long nextLong(){
          return Long.parseLong(next());
         }
         double nextDouble(){
          return Double.parseDouble(next());
         }

   }
   public static void main(String args[])throws IOException{
       FastReader in=new FastReader();
       int n=in.nextInt();
       HashMap<Integer,Integer>map=new HashMap<Integer,Integer>();
       for(int i=0;i<n;i++){
          int x=in.nextInt();
             if(map.containsKey(x)){
               int v=map.get(x);
               map.put(x,v+1);
             }
             else
                map.put(x,1);
           }
         int Q=in.nextInt();
         while(Q-->0){
              char c=in.next().charAt(0); int x=in.nextInt();
              int v=0;
              if(map.containsKey(x))
                v=map.get(x);
              if(c=='+')
                map.put(x,v+1);
              else
                map.put(x,v-1);
             boolean sq=false,rec=false,side1=false,side2=false;
             for(Map.Entry m:map.entrySet()){
                int key=(int)m.getKey();
                int value=(int)m.getValue();
                if(value>=8){sq=true; rec=true; break;}
               else if(value>=4){
                if(!sq){
                  sq=true;
                  if(value-4>=2){
                    side1=true;
                      }
                  }
                else{
                  rec=true; break;
                }
                }
              else if(value>=2){
                if(!side1)
                  side1=true;
               else{ side2=true; rec=true;}

              }

             }
             if(rec==true &&  sq==true)
               System.out.println("YES");
             else
              System.out.println("NO");

         }

   }

}


import java.io.*;
import java.math.*;
import java.util.*;

public class Solve {
    FastScanner in;
    PrintWriter out;

    void solve() {
        int n = in.nextInt();
        int[] a = new int[n];
        long[] counts = new long[100001];
        for (int i = 0; i < n; i++) {
            int tmp = in.nextInt();
            a[i] = tmp;
            counts[tmp]++;
        }

        long c2 = 0;
        long c4 = 0;
        long c6 = 0;
        long c8 = 0;

        for (int i = 0; i < counts.length; i++) {
            if (8 <= counts[i]) {
                c8++;
            } else if (6 <= counts[i]) {
                c6++;
            } else if (4 <= counts[i]) {
                c4++;
            } else if (2 <= counts[i]) {
                c2++;
            }
        }

        int q = in.nextInt();
        while (0 < q--) {
            char sign = in.next().toCharArray()[0];
            int plank = in.nextInt();

            if (8 <= counts[plank]) {
                c8--;
            } else if (6 <= counts[plank]) {
                c6--;
            } else if (4 <= counts[plank]) {
                c4--;
            } else if (2 <= counts[plank]) {
                c2--;
            }

            if (sign == '+') {
                counts[plank]++;
            } else {
                counts[plank]--;
            }

            if (8 <= counts[plank]) {
                c8++;
            } else if (6 <= counts[plank]) {
                c6++;
            } else if (4 <= counts[plank]) {
                c4++;
            } else if (2 <= counts[plank]) {
                c2++;
            }

            // out.println(c2 + " " + c4 + " " + c6 + " " + c8);

            if (0 < c8 ||
                (0 < c2 && 0 < c6) ||
                (0 < c4 && 0 < c6) ||
                (0 < c4 && 1 < c2) ||
                1 < c4) {
                out.println("YES");
            } else {
                out.println("NO");
            }

        }

        // 4+2+2
        // 4+4
        // 6+2
        // 8

        // 1 x5
        // 2 x1

        // 1 x5
        // 2 x2 NO

        // 1 x6
        // 2 x2 YES  1 2 1 2  + 1 1 1 1

        // 1 x5
        // 2 x2 NO

        // 1 x5
        // 2 x3 NO

        // 1 x4
        // 2 x3 NO

        // 1 x4
        // 2 x4 YES 1 1 1 1  + 2 2 2 2

    }

    void run() {
        try {
            in = new FastScanner(new File("Solve.in"));
            out = new PrintWriter(new File("Solve.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    void runIO() {

        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextLong();
            }
            return a;
        }

        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        double[] nextDoubleArray(int n) {
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextDouble();
            }
            return a;
        }

    }

    public static void main(String[] args) {
        new Solve().runIO();
    }
}


import java.io.*;
import java.math.*;
import java.util.*;

public class Solve {
    FastScanner in;
    PrintWriter out;

    void solve() {
        int n = in.nextInt();
        int[] a = new int[n];
        long[] counts = new long[100001];
        for (int i = 0; i < n; i++) {
            int tmp = in.nextInt();
            a[i] = tmp;
            counts[tmp]++;
        }

        long c2 = 0;
        long c4 = 0;
        long c6 = 0;
        long c8 = 0;

        for (int i = 0; i < counts.length; i++) {
            if (8 <= counts[i]) {
                c8++;
            } else if (6 <= counts[i]) {
                c6++;
            } else if (4 <= counts[i]) {
                c4++;
            } else if (2 <= counts[i]) {
                c2++;
            }
        }

        int q = in.nextInt();
        while (0 < q--) {
            char sign = in.next().toCharArray()[0];
            int plank = in.nextInt();

            if (8 <= counts[plank]) {
                c8--;
            } else if (6 <= counts[plank]) {
                c6--;
            } else if (4 <= counts[plank]) {
                c4--;
            } else if (2 <= counts[plank]) {
                c2--;
            }

            if (sign == '+') {
                counts[plank]++;
            } else {
                counts[plank]--;
            }

            if (8 <= counts[plank]) {
                c8++;
            } else if (6 <= counts[plank]) {
                c6++;
            } else if (4 <= counts[plank]) {
                c4++;
            } else if (2 <= counts[plank]) {
                c2++;
            }

            // out.println(c2 + " " + c4 + " " + c6 + " " + c8);

            if (0 < c8 ||
                (0 < c2 && 0 < c6) ||
                (0 < c4 && 1 < c2) ||
                1 < c4) {
                out.println("YES");
            } else {
                out.println("NO");
            }

        }

        // 4+2+2
        // 4+4
        // 6+2
        // 8

        // 1 x5
        // 2 x1

        // 1 x5
        // 2 x2 NO

        // 1 x6
        // 2 x2 YES  1 2 1 2  + 1 1 1 1

        // 1 x5
        // 2 x2 NO

        // 1 x5
        // 2 x3 NO

        // 1 x4
        // 2 x3 NO

        // 1 x4
        // 2 x4 YES 1 1 1 1  + 2 2 2 2

    }

    void run() {
        try {
            in = new FastScanner(new File("Solve.in"));
            out = new PrintWriter(new File("Solve.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    void runIO() {

        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextLong();
            }
            return a;
        }

        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        double[] nextDoubleArray(int n) {
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextDouble();
            }
            return a;
        }

    }

    public static void main(String[] args) {
        new Solve().runIO();
    }
}


import java.io.*;
import java.math.*;
import java.util.*;

public class Solve {
    FastScanner in;
    PrintWriter out;

    void solve() {
        int n = in.nextInt();
        int[] a = new int[n];
        int[] counts = new int[100001];
        for (int i = 0; i < n; i++) {
            int tmp = in.nextInt();
            a[i] = tmp;
            counts[tmp]++;
        }

        int c2 = 0;
        int c4 = 0;
        int c6 = 0;
        int c8 = 0;

        for (int i = 0; i < counts.length; i++) {
            if (8 <= counts[i]) {
                c8++;
            } else if (6 <= counts[i]) {
                c6++;
            } else if (4 <= counts[i]) {
                c4++;
            } else if (2 <= counts[i]) {
                c2++;
            }
        }

        int q = in.nextInt();
        while (0 < q--) {
            char sign = in.next().toCharArray()[0];
            int plank = in.nextInt();

            if (8 <= counts[plank]) {
                c8--;
            } else if (6 <= counts[plank]) {
                c6--;
            } else if (4 <= counts[plank]) {
                c4--;
            } else if (2 <= counts[plank]) {
                c2--;
            }

            if (sign == '+') {
                counts[plank]++;
            } else {
                counts[plank]--;
            }

            if (8 <= counts[plank]) {
                c8++;
            } else if (6 <= counts[plank]) {
                c6++;
            } else if (4 <= counts[plank]) {
                c4++;
            } else if (2 <= counts[plank]) {
                c2++;
            }

            // out.println(c2 + " " + c4 + " " + c6 + " " + c8);

            if (0 < c8 ||
                (0 < c2 && 0 < c6) ||
                (0 < c4 && 1 < c2) ||
                1 < c4) {
                out.println("YES");
            } else {
                out.println("NO");
            }

        }

        // 4+4
        // 4+2+2
        // 6+2
        // 8

        // 1 x5
        // 2 x1

        // 1 x5
        // 2 x2 NO

        // 1 x6
        // 2 x2 YES  1 2 1 2  + 1 1 1 1

        // 1 x5
        // 2 x2 NO

        // 1 x5
        // 2 x3 NO

        // 1 x4
        // 2 x3 NO

        // 1 x4
        // 2 x4 YES 1 1 1 1  + 2 2 2 2

    }

    void run() {
        try {
            in = new FastScanner(new File("Solve.in"));
            out = new PrintWriter(new File("Solve.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    void runIO() {

        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextLong();
            }
            return a;
        }

        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        double[] nextDoubleArray(int n) {
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextDouble();
            }
            return a;
        }

    }

    public static void main(String[] args) {
        new Solve().runIO();
    }
}


import java.io.*;
import java.math.*;
import java.util.*;

public class Solve {
    FastScanner in;
    PrintWriter out;

    void solve() {
        int n = in.nextInt();
        int[] a = new int[n];
        int[] counts = new int[100001];
        for (int i = 0; i < n; i++) {
            int tmp = in.nextInt();
            a[i] = tmp;
            counts[tmp]++;
        }

        int q = in.nextInt();
        while (0 < q--) {
            char sign = in.next().toCharArray()[0];
            int plank = in.nextInt();

            if (sign == '+') {
                counts[plank]++;
            } else {
                counts[plank]--;
            }

            int c2 = 0;
            int c4 = 0;
            int c6 = 0;
            int c8 = 0;

            for (int i = 0; i < counts.length; i++) {

                if (8 <= counts[i]) {
                    c8++;
                } else if (6 <= counts[i]) {
                    c6++;
                } else if (4 <= counts[i]) {
                    c4++;
                } else if (2 <= counts[i]) {
                    c2++;
                }
            }

            if (0 < c8 ||
                (0 < c2 && 0 < c6) ||
                1 < c4) {
                out.println("YES");
            } else {
                out.println("NO");
            }

        }

        // 4+4
        // 6+2
        // 8

        // 1 x5
        // 2 x1

        // 1 x5
        // 2 x2 NO

        // 1 x6
        // 2 x2 YES  1 2 1 2  + 1 1 1 1

        // 1 x5
        // 2 x2 NO

        // 1 x5
        // 2 x3 NO

        // 1 x4
        // 2 x3 NO

        // 1 x4
        // 2 x4 YES 1 1 1 1  + 2 2 2 2

    }

    void run() {
        try {
            in = new FastScanner(new File("Solve.in"));
            out = new PrintWriter(new File("Solve.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    void runIO() {

        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextLong();
            }
            return a;
        }

        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        double[] nextDoubleArray(int n) {
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextDouble();
            }
            return a;
        }

    }

    public static void main(String[] args) {
        new Solve().runIO();
    }
}


import java.io.*;
import java.math.*;
import java.util.*;

public class Solve {
    FastScanner in;
    PrintWriter out;

    void solve() {
        int n = in.nextInt();
        int[] a = new int[n];
        long[] counts = new long[100001];
        for (int i = 0; i < n; i++) {
            int tmp = in.nextInt();
            a[i] = tmp;
            counts[tmp]++;
        }

        long c2 = 0;
        long c4 = 0;
        long c6 = 0;
        long c8 = 0;

        for (int i = 0; i < counts.length; i++) {
            if (8 <= counts[i]) {
                c8++;
            } else if (6 <= counts[i]) {
                c6++;
            } else if (4 <= counts[i]) {
                c4++;
            } else if (2 <= counts[i]) {
                c2++;
            }
        }

        int q = in.nextInt();
        while (0 < q--) {
            char sign = in.next().toCharArray()[0];
            int plank = in.nextInt();

            if (8 <= counts[plank]) {
                c8--;
            } else if (6 <= counts[plank]) {
                c6--;
            } else if (4 <= counts[plank]) {
                c4--;
            } else if (2 <= counts[plank]) {
                c2--;
            }

            if (sign == '+') {
                counts[plank]++;
            } else {
                counts[plank]--;
            }

            if (8 <= counts[plank]) {
                c8++;
            } else if (6 <= counts[plank]) {
                c6++;
            } else if (4 <= counts[plank]) {
                c4++;
            } else if (2 <= counts[plank]) {
                c2++;
            }

            // out.println(c2 + " " + c4 + " " + c6 + " " + c8);

            if (0 < c8 ||
                (0 < c2 && 0 < c6) ||
                (0 < c4 && 0 < c6) ||
                (0 < c4 && 1 < c2) ||
                1 < c6 ||
                1 < c4) {
                out.println("YES");
            } else {
                out.println("NO");
            }

        }

        // 4+2+2
        // 4+4
        // 6+2
        // 8

        // 1 x5
        // 2 x1

        // 1 x5
        // 2 x2 NO

        // 1 x6
        // 2 x2 YES  1 2 1 2  + 1 1 1 1

        // 1 x5
        // 2 x2 NO

        // 1 x5
        // 2 x3 NO

        // 1 x4
        // 2 x3 NO

        // 1 x4
        // 2 x4 YES 1 1 1 1  + 2 2 2 2

    }

    void run() {
        try {
            in = new FastScanner(new File("Solve.in"));
            out = new PrintWriter(new File("Solve.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    void runIO() {

        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextLong();
            }
            return a;
        }

        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        double[] nextDoubleArray(int n) {
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextDouble();
            }
            return a;
        }

    }

    public static void main(String[] args) {
        new Solve().runIO();
    }
}


import java.io.*;
import java.math.*;
import java.util.*;

public class Solve {
    FastScanner in;
    PrintWriter out;

    void solve() {
        int n = in.nextInt();
        int[] a = new int[n];
        int[] counts = new int[100001];
        for (int i = 0; i < n; i++) {
            int tmp = in.nextInt();
            a[i] = tmp;
            counts[tmp]++;
        }

        int q = in.nextInt();
        while (0 < q--) {
            char sign = in.next().toCharArray()[0];
            int plank = in.nextInt();

            if (sign == '+') {
                counts[plank]++;
            } else {
                counts[plank]--;
            }

            int c2 = 0;
            int c4 = 0;
            int c6 = 0;
            int c8 = 0;

            for (int i = 0; i < counts.length; i++) {

                if (8 <= counts[i]) {
                    c8++;
                } else if (6 <= counts[i]) {
                    c6++;
                } else if (4 <= counts[i]) {
                    c4++;
                } else if (2 <= counts[i]) {
                    c2++;
                }
            }

            // out.println(c2 + " " + c4 + " " + c6 + " " + c8);

            if (0 < c8 ||
                (0 < c2 && 0 < c6) ||
                (0 < c4 && 1 < c2) ||
                1 < c4) {
                out.println("YES");
            } else {
                out.println("NO");
            }

        }

        // 4+4
        // 4+2+2
        // 6+2
        // 8

        // 1 x5
        // 2 x1

        // 1 x5
        // 2 x2 NO

        // 1 x6
        // 2 x2 YES  1 2 1 2  + 1 1 1 1

        // 1 x5
        // 2 x2 NO

        // 1 x5
        // 2 x3 NO

        // 1 x4
        // 2 x3 NO

        // 1 x4
        // 2 x4 YES 1 1 1 1  + 2 2 2 2

    }

    void run() {
        try {
            in = new FastScanner(new File("Solve.in"));
            out = new PrintWriter(new File("Solve.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    void runIO() {

        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextLong();
            }
            return a;
        }

        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        double[] nextDoubleArray(int n) {
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextDouble();
            }
            return a;
        }

    }

    public static void main(String[] args) {
        new Solve().runIO();
    }
}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Applejack_and_Storages {

	public static void main(String[] args) throws java.lang.Exception
    {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		int a[]=new int[n],f[]=new int[10001];
		StringTokenizer st=new StringTokenizer(br.readLine());
		for(int i=0; i<n; i++) {
			a[i]=Integer.parseInt(st.nextToken());
			++f[a[i]];
		}
		int t=Integer.parseInt(br.readLine());
		while(t-->0) {
			String s=br.readLine();
			int x=Integer.parseInt(s.substring(2));
			if(s.charAt(0)=='+') ++f[x];
			else --f[x];
			int b=0,b1=0,c=0,c1=0,d=0;
			for(int i=0; i<f.length; i++) if(f[i]>=4) {b=f[i];b1=i;break;}
			for(int i=0; i<f.length; i++) if(f[i]>=2 && i!=b1) {c=f[i];c1=i;break;}
			for(int i=0; i<f.length; i++) if(f[i]>=2 && i!=b1 && i!=c1) {d=f[i];break;}
			if(b>=8 || b>=6 && c>=2 || b>=4 && c>=4 || b>=4 && c>=2 && d>=2) {
				System.out.println("YES");
			}else System.out.println("NO");
		}
	}

}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Applejack_and_Storages {

	public static void main(String[] args) throws java.lang.Exception
    {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		int f[]=new int[100001];
		StringTokenizer st=new StringTokenizer(br.readLine());
		int n2=0,n4=0,n6=0,n8=0;
		for(int i=0; i<n; i++) {
			int a=Integer.parseInt(st.nextToken());
			++f[a];
			if(f[a]==2) ++n2;
			else if(f[a]==4) ++n4;
			else if(f[a]==6) ++n6;
			else if(f[a]==8) ++n8;
		}
		int t=Integer.parseInt(br.readLine());
		while(t-->0) {
			String s=br.readLine();
			int x=Integer.parseInt(s.substring(2));
			if(s.charAt(0)=='+') {
				++f[x];
				if(f[x]==2) ++n2;
				else if(f[x]==4) ++n4;
				else if(f[x]==6) ++n6;
				else if(f[x]==8) ++n8;
			}
			else {
				if(f[x]==2) --n2;
				else if(f[x]==4) --n4;
				else if(f[x]==6) --n6;
				else if(f[x]==8) --n8;
				--f[x];
			}
			System.out.println(n8>=1 || n6>=1 && n2>=2 || n4>=2 || n4>=1 && n2>=3?"YES":"NO");
		}
	}

}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Applejack_and_Storages {

	public static void main(String[] args) throws java.lang.Exception
    {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		List<Integer> l=new ArrayList<>();
		StringTokenizer st=new StringTokenizer(br.readLine());
		for(int i=0; i<n; i++) l.add(Integer.parseInt(st.nextToken()));
		int t=Integer.parseInt(br.readLine());
		while(t-->0) {
			String s=br.readLine();
			if(s.charAt(0)=='+') l.add(Integer.parseInt(""+s.charAt(s.length()-1)));
			else l.remove(Integer.parseInt(""+s.charAt(s.length()-1)));
			if(l.size()<8) System.out.println("NO");
			else {
				Map<Integer, Integer> m=new HashMap<>();
				for(int i=0; i<l.size(); i++) {
					if(m.containsKey(l.get(i))) m.put(l.get(i), m.get(l.get(i))+1);
					else m.put(l.get(i), 1);
				}
				int a=0;
				for(Integer e: m.keySet()) if(m.get(e)>=4) {a=m.get(e);m.remove(e, m.get(e));break;}
				if(a>=8) System.out.println("YES");
				else if(a>=6) {
					int b=0;
					for(Integer e: m.keySet()) if(m.get(e)>=2) {b=m.get(e);m.remove(e, m.get(e));break;}
					System.out.println(b>=2?"YES":"NO");
				}else if(a>=4) {
					int b=0;
					for(Integer e: m.keySet()) if(m.get(e)>=2) {b=m.get(e);m.remove(e, m.get(e));break;}
					if(b>=4 ) System.out.println("YES");
					else if(b>=2){
						int c=0;
						for(Integer e: m.keySet()) if(m.get(e)>=2) {c=m.get(e);m.remove(e, m.get(e));break;}
						System.out.println(c>=2?"YES":"NO");
					}else System.out.println("NO");
				}else System.out.println("NO");
			}
		}
	}

}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Applejack_and_Storages {

	public static void main(String[] args) throws java.lang.Exception
    {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		int a[]=new int[n],f[]=new int[100001];
		StringTokenizer st=new StringTokenizer(br.readLine());
		for(int i=0; i<n; i++) {
			a[i]=Integer.parseInt(st.nextToken());
			++f[a[i]];
		}
		int t=Integer.parseInt(br.readLine());
		while(t-->0) {
			String s=br.readLine();
			int x=Integer.parseInt(s.substring(2));
			if(s.charAt(0)=='+') ++f[x];
			else --f[x];
			int b=0,b1=0,c=0,c1=0,d=0;
			for(int i=0; i<f.length; i++) if(f[i]>=4) {b=f[i];b1=i;break;}
			for(int i=0; i<f.length; i++) if(f[i]>=2 && i!=b1) {c=f[i];c1=i;break;}
			for(int i=0; i<f.length; i++) if(f[i]>=2 && i!=b1 && i!=c1) {d=f[i];break;}
			if(b>=8 || b>=6 && c>=2 || b>=4 && c>=4 || b>=4 && c>=2 && d>=2) {
				System.out.println("YES");
			}else System.out.println("NO");
		}
	}

}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Applejack_and_Storages {

	public static void main(String[] args) throws java.lang.Exception
    {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		List<Integer> l=new ArrayList<>();
		StringTokenizer st=new StringTokenizer(br.readLine());
		for(int i=0; i<n; i++) l.add(Integer.parseInt(st.nextToken()));
		int t=Integer.parseInt(br.readLine());
		while(t-->0) {
				String s=br.readLine();
				int x=Integer.parseInt(s.substring(2));
				if(s.charAt(0)=='+') l.add(x);
				else {
					for(int i=0; i<l.size(); i++) {
						if(l.get(i)==x) {l.remove(i);break;}
					}
				}
				if(l.size()<8) System.out.println("NO");
				else {
					Map<Integer, Integer> m=new HashMap<>();
					for(int i=0; i<l.size(); i++) {
						if(m.containsKey(l.get(i))) m.put(l.get(i), m.get(l.get(i))+1);
						else m.put(l.get(i), 1);
					}
					int a=0;
					for(Integer e: m.keySet()) {if(m.get(e)>=4) {a=m.get(e);m.remove(e, m.get(e));break;}}
					if(a>=8) System.out.println("YES");
					else if(a>=6) {
						int b=0;
						for(Integer e: m.keySet()) {if(m.get(e)>=2) {b=m.get(e);m.remove(e, m.get(e));break;}}
						System.out.println(b>=2?"YES":"NO");
					}else if(a>=4) {
						int b=0;
						for(Integer e: m.keySet()) {if(m.get(e)>=2) {b=m.get(e);m.remove(e, m.get(e));break;}}
						if(b>=4 ) System.out.println("YES");
						else if(b>=2){
							int c=0;
							for(Integer e: m.keySet()) {if(m.get(e)>=2) {c=m.get(e);m.remove(e, m.get(e));break;}}
							System.out.println(c>=2?"YES":"NO");
						}else System.out.println("NO");
					}else System.out.println("NO");
				}
		}
	}

}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Applejack_and_Storages {

	public static void main(String[] args) throws java.lang.Exception
    {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		int f[]=new int[100001];
		StringTokenizer st=new StringTokenizer(br.readLine());
		for(int i=0; i<n; i++) {
			int a=Integer.parseInt(st.nextToken());
			++f[a];
		}
		int t=Integer.parseInt(br.readLine());
		while(t-->0) {
			String s=br.readLine();
			int x=Integer.parseInt(s.substring(2));
			if(s.charAt(0)=='+') ++f[x];
			else --f[x];
			int b=0,b1=0,c=0,c1=0,d=0,d1=0;
			for(int i=0; i<f.length; i++) {
				if(f[i]>=4 && b1==0) {b=f[i];b1=i;}
				if(f[i]>=2 && i!=b1 && c1==0) {c=f[i];c1=i;}
				if(f[i]>=2 && i!=b1 && i!=c1 && d1==0) {d=f[i];d1=i;}
			}
			if(b>=8 || b>=6 && c>=2 || b>=4 && c>=4 || b>=4 && c>=2 && d>=2) {
				System.out.println("YES");
			}else System.out.println("NO");
		}
	}

}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Applejack_and_Storages {

	public static void main(String[] args) throws java.lang.Exception
    {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		int f[]=new int[100001];
		StringTokenizer st=new StringTokenizer(br.readLine());
		for(int i=0; i<n; i++) {
			int a=Integer.parseInt(st.nextToken());
			++f[a];
		}
		int t=Integer.parseInt(br.readLine());
		while(t-->0) {
			String s=br.readLine();
			int x=Integer.parseInt(s.substring(2));
			if(s.charAt(0)=='+') ++f[x];
			else --f[x];
			int b=0,b1=0,c=0,c1=0,d=0;
			for(int i=0; i<f.length; i++) if(f[i]>=4) {b=f[i];b1=i;break;}
			for(int i=0; i<f.length; i++) if(f[i]>=2 && i!=b1) {c=f[i];c1=i;break;}
			for(int i=0; i<f.length; i++) if(f[i]>=2 && i!=b1 && i!=c1) {d=f[i];break;}
			if(b>=8 || b>=6 && c>=2 || b>=4 && c>=4 || b>=4 && c>=2 && d>=2) {
				System.out.println("YES");
			}else System.out.println("NO");
		}
	}

}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Applejack_and_Storages {

	public static void main(String[] args) throws java.lang.Exception
    {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		int f[]=new int[100001];
		StringTokenizer st=new StringTokenizer(br.readLine());
		int n2=0,n4=0,n6=0,n8=0;
		for(int i=0; i<n; i++) {
			int a=Integer.parseInt(st.nextToken());
			++f[a];
			if(f[a]==2) ++n2;
			else if(f[a]==4) ++n4;
			else if(f[a]==6) ++n6;
			else if(f[a]==8) ++n8;
		}
		int t=Integer.parseInt(br.readLine());
		while(t-->0) {
			String s=br.readLine();
			int x=Integer.parseInt(s.substring(2));
			if(s.charAt(0)=='+') {
				++f[x];
				if(f[x]==2) ++n2;
				else if(f[x]==4) ++n4;
				else if(f[x]==6) ++n6;
				else if(f[x]==8) ++n8;
			}
			else {
				if(f[x]==2) --n2;
				else if(f[x]==4) --n4;
				else if(f[x]==6) --n6;
				else if(f[x]==8) --n8;
				--f[x];
			}
			System.out.println(n8>=1 || n6>=1 && n2>=2 || n4>=2 || n4>=1 && n2>=3?"YES":"N0");
		}
	}

}


import javax.print.DocFlavor;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class demo_B {
    public static void main(String[] args) throws IOException { //
//        Scanner sc = new Scanner(System.in);
        HashMap<Integer,Integer> map=new HashMap<Integer, Integer>();
        BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
//        int t = Integer.valueOf(sc.readLine());
        //998244353
//        for (int i = 0; i < t; i++) {
        int s = Integer.parseInt(sc.readLine()),q,keylen=0;
        String[] a=sc.readLine().split(" ");
        boolean flag1=false;
        int[] an=new int[s];
        int[] flag=new int[100000],key=new int[100000];
        Arrays.fill(flag,0);
        for (int j = 0; j < s; j++) {
            an[j] = Integer.parseInt(a[j]);
            if (flag[an[j]]==0) {
                key[j] = an[j];
                keylen++;
            }
            flag[an[j]]++;
        }
        q=Integer.parseInt(sc.readLine());
        int zheng=0,chang=0,kuang=0;
        for (int i = 0; i < q; i++) {
            String[] ss=sc.readLine().split(" ");
            if (ss[0].equals("+")){
                if (flag1!=false){
                    System.out.println("YES");
                }else {
                    if (flag[Integer.parseInt(ss[1])]==0){
                        key[keylen]=Integer.parseInt(ss[1]);
                    }
                    flag[Integer.parseInt(ss[1])]++;
                    for (int j = 0; j < s+q; j++) {
                        if (flag[key[j]]>=4){
                            zheng++;
                            if (flag[key[j]]>=6)
                                chang++;
                        }
                        if (flag[key[j]]>=2){
                            kuang++;
                        }
                    }
                    if (zheng>0&&(chang+kuang+zheng>3))
                        System.out.println("YES");
                    else
                        System.out.println("NO");
                    zheng=0;kuang=0;chang=0;
                }
            }else {
                flag[Integer.parseInt(ss[1])]--;
                for (int j = 0; j < s+q; j++) {
                    if (flag[key[j]]>=4){
                        zheng++;
                        if (flag[key[j]]>=6)
                            chang++;
                    }
                    if (flag[key[j]]>=2){
                        kuang++;
                    }
                }
                if (zheng>0&&(chang+kuang+zheng>3))
                    System.out.println("YES");
                else
                    System.out.println("NO");
                zheng=0;kuang=0;chang=0;
            }
        }
//        }
    }
}


import javax.print.DocFlavor;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;

public class demo_B {
    public static void main(String[] args) throws IOException { //
//        Scanner sc = new Scanner(System.in);
        HashMap<Integer,Integer> map=new HashMap<Integer, Integer>();
        BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
//        int t = Integer.valueOf(sc.readLine());
        //998244353
//        for (int i = 0; i < t; i++) {
        int s = Integer.parseInt(sc.readLine()),q,keylen=0;
        String[] a=sc.readLine().split(" ");
        boolean flag1=false;
        int[] an=new int[s];
        Integer[] flag=new Integer[200000],key=new Integer[200000];
        Arrays.fill(flag,0);
        for (int j = 0; j < s; j++) {
            an[j] = Integer.parseInt(a[j]);
            flag[an[j]]++;
        }
        q=Integer.parseInt(sc.readLine());
        int zheng=0,chang=0,kuang=0;
        for (int i = 0; i < q; i++) {
            String[] ss=sc.readLine().split(" ");
            for (int j = 0; j < 200000; j++) {
                key[j]=flag[j];
            }
            if (ss[0].equals("+")) {
                flag[Integer.parseInt(ss[1])]++;
                key[Integer.parseInt(ss[1])]++;
                if (flag1)
                    System.out.println("YES");
                else {
                    Arrays.sort(key, Collections.reverseOrder());
                    if ((key[0]>=8)||(key[0]>=4&&key[1]>=4)) {
                        System.out.println("YES");
                        flag1=true;
                    }
                    else if (key[0]>=6&&key[1]>=2){
                        System.out.println("YES");
                        flag1=true;
                    }
                    else if (key[0]>=4&&key[1]>=2&&key[2]>=2){
                        System.out.println("YES");
                        flag1=true;
                    }
                    else{
                        System.out.println("NO");
                        flag1=false;
                    }
                }
            }
            else {
                flag[Integer.parseInt(ss[1])]--;
                key[Integer.parseInt(ss[1])]--;
                Arrays.sort(key, Collections.reverseOrder());
                if (key[0] >= 8||(key[0]>=8)||(key[0]>=4&&key[1]>=4)){
                    System.out.println("YES");
                    flag1=true;
                }
                else if (key[0] >= 6 && key[1] >= 2){
                    System.out.println("YES");
                    flag1=true;
                }
                else if (key[0] >= 4 && key[1] >= 2 && key[2] >= 2){
                    System.out.println("YES");
                    flag1=true;
                }
                else{
                    System.out.println("NO");
                    flag1=false;
                }
            }
        }
//        }
    }
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,i,j,john,mark;
    cin>>n;

    int a[n+1];
    int sum;
    for(i=1;i<=n;i++)
    {
        sum=0;
        for(j=0;j<4;j++)
        {
            cin>>mark;
            sum+=mark;
        }

        if(i==1) john=sum;
        a[i]=sum;

    }

    sort(a+1,a+n+1);
    reverse(a+1,a+n+1);

    int index;
    for(i=1;i<=n;i++)
    {
        if(a[i]==john)
        {
            index=i;
            break;
        }
    }

    cout<<index<<endl;

}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int m;
    while(scanf("%d",&m)!=EOF){
        int a,b,c,d;
        int max1;
        int id=0;
        for(int i=0;i<m;i++){
            scanf("%d%d%d%d",&a,&b,&c,&d);
            if(a+b+c+d>max1){
                max1=a+b+c+d;
                id++;
            }
        }
        printf("%d\n",id);
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int m;
    while(scanf("%d",&m)!=EOF){
        int a,b,c,d;
        int maxn=-1;
        int id=0;
        for(int i=0;i<m;i++){
            scanf("%d%d%d%d",&a,&b,&c,&d);
            if(a+b+c+d>maxn){
                maxn=a+b+c+d;
                id++;
            }
        }
        printf("%d\n",id);
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int m;
    while(scanf("%d",&m)!=EOF){
        int a,b,c,d;
        int maxn=0;
        int id=0;
        for(int i=0;i<m;i++){
            scanf("%d%d%d%d",&a,&b,&c,&d);
            if(a+b+c+d>max1){
                maxn=a+b+c+d;
                id++;
            }
        }
        printf("%d\n",id);
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int m;
    while(scanf("%d",&m)!=EOF){
        int a,b,c,d;
        int maxn=-1;
        int id=0;
        for(int i=0;i<m;i++){
            scanf("%d%d%d%d",&a,&b,&c,&d);
            if(a+b+c+d>maxn){
                if(i==0){
                    maxn=a+b+c+d;
                }
                id++;
            }
        }
        printf("%d\n",id);
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int m;
    while(scanf("%d",&m)!=EOF){
        int a,b,c,d;
        int maxn=0;
        int id=0;
        for(int i=0;i<m;i++){
            scanf("%d%d%d%d",&a,&b,&c,&d);
            if(a+b+c+d>maxn){
                maxn=a+b+c+d;
                id++;
            }
        }
        printf("%d\n",id);
    }
}


#include<bits/stdc++.h>
using namespace std;
struct node {
	int he,id;
} a[120000];
bool cmp(node x,node y) {
	if(x.he!=y.he) return x.he>y.he;
	else return x.id<y.id;
}
int main() {
	int n;
	cin>>n;
	for(int i=1;i<=n;i++) {
		int q,w,e,r;
		cin>>q>>w>>e>>r;
		a[i].id=i;
		a[i].he=q+w+e+r;
	}
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++)
		if(a[i].id==1)  {
			cout<<i;
			return 0;
		}
	return 0;
}


#include<map>
#include<set>
#include<list>
#include<ctime>
#include<cmath>
#include<deque>
#include<queue>
#include<stack>
#include<string>
#include<vector>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<iostream>
#include<algorithm>
#define rep(i,s,t) for(register int i=s;i<=t;++i)
#define _rep(i,s,t) for(register int i=s;i>=t;--i)
#define Rep(i,s,t) for(register int i=s;i<t;++i)
#define go(x) for(register int e=las[x];e;e=nxt[e])
#define re register
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define insert is
#define erase es
#define pii pair<int,int>
#define ms(f,x) memset(f,x,sizeof f)
#define mc(f,x) memcpy(f,x,sizeof f)
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
#define gi(x) read(x)
#define gii(x,y) read(x),read(y)
#define giii(x,y,z) read(x),read(y),read(z)
namespace IO{
    #define gc getchar()
    #define pc(x) putchar(x)
    template<typename T>inline void read(T &x){
        x=0;int f=1;char ch=gc;while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=gc;}
        while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=gc;x*=f;return;
    }
    template<typename T>inline void write(T x=0){
        T wr[51];wr[0]=0;if(x<0)pc('-'),x=-x;if(!x)pc(48);
        while(x)wr[++wr[0]]=x%10,x/=10;while(wr[0])pc(48+wr[wr[0]--]);return;
    }
}
using IO::read;
using IO::write;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned long long ull;
using namespace std;
int n,a[1004],b[1004],c[1004],d[1004],sum[1004],ans;
int main(){
	gi(n);
	rep(i,1,n)
		gii(a[i],b[i]),gii(c[i],d[i]),sum[i]=a[i]+b[i]+c[i]+d[i];
	rep(i,2,n)
		if(sum[i]>sum[1])
			++ans;
	printf("%d\n",ans+1);
	return 0;
}


#include<map>
#include<set>
#include<list>
#include<ctime>
#include<cmath>
#include<deque>
#include<queue>
#include<stack>
#include<string>
#include<vector>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<iostream>
#include<algorithm>
#define rep(i,s,t) for(register int i=s;i<=t;++i)
#define _rep(i,s,t) for(register int i=s;i>=t;--i)
#define Rep(i,s,t) for(register int i=s;i<t;++i)
#define go(x) for(register int e=las[x];e;e=nxt[e])
#define re register
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define insert is
#define erase es
#define pii pair<int,int>
#define ms(f,x) memset(f,x,sizeof f)
#define mc(f,x) memcpy(f,x,sizeof f)
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
#define gi(x) read(x)
#define gii(x,y) read(x),read(y)
#define giii(x,y,z) read(x),read(y),read(z)
namespace IO{
    #define gc getchar()
    #define pc(x) putchar(x)
    template<typename T>inline void read(T &x){
        x=0;int f=1;char ch=gc;while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=gc;}
        while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=gc;x*=f;return;
    }
    template<typename T>inline void write(T x=0){
        T wr[51];wr[0]=0;if(x<0)pc('-'),x=-x;if(!x)pc(48);
        while(x)wr[++wr[0]]=x%10,x/=10;while(wr[0])pc(48+wr[wr[0]--]);return;
    }
}
using IO::read;
using IO::write;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned long long ull;
using namespace std;
int n,a[104],b[104],c[104],d[104],sum[104],ans;
int main(){
	gi(n);
	rep(i,1,n)
		gii(a[i],b[i]),gii(c[i],d[i]),sum[i]=a[i]+b[i]+c[i]+d[i];
	rep(i,2,n)
		if(sum[i]>sum[1])
			++ans;
	printf("%d\n",ans+1);
	return 0;
}


#include<map>
#include<set>
#include<list>
#include<ctime>
#include<cmath>
#include<deque>
#include<queue>
#include<stack>
#include<string>
#include<vector>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<iostream>
#include<algorithm>
#define rep(i,s,t) for(register int i=s;i<=t;++i)
#define _rep(i,s,t) for(register int i=s;i>=t;--i)
#define Rep(i,s,t) for(register int i=s;i<t;++i)
#define go(x) for(register int e=las[x];e;e=nxt[e])
#define re register
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define insert is
#define erase es
#define pii pair<int,int>
#define ms(f,x) memset(f,x,sizeof f)
#define mc(f,x) memcpy(f,x,sizeof f)
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
#define gi(x) read(x)
#define gii(x,y) read(x),read(y)
#define giii(x,y,z) read(x),read(y),read(z)
namespace IO{
    #define gc getchar()
    #define pc(x) putchar(x)
    template<typename T>inline void read(T &x){
        x=0;int f=1;char ch=gc;while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=gc;}
        while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=gc;x*=f;return;
    }
    template<typename T>inline void write(T x=0){
        T wr[51];wr[0]=0;if(x<0)pc('-'),x=-x;if(!x)pc(48);
        while(x)wr[++wr[0]]=x%10,x/=10;while(wr[0])pc(48+wr[wr[0]--]);return;
    }
}
using IO::read;
using IO::write;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned long long ull;
using namespace std;
int n,a[104],b[104],c[104],d[104],sum[1004],ans;
int main(){
	gi(n);
	rep(i,1,n)
		gii(a[i],b[i]),gii(c[i],d[i]),sum[i]=a[i]+b[i]+c[i]+d[i];
	rep(i,2,n)
		if(sum[i]>sum[1])
			++ans;
	printf("%d\n",ans+1);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
struct node {
	int s,id;
}p[1005];
int read() {
	char c=getchar(); int x=0,f=1;
	while (c<'0' || c>'9') {
		if (c=='-') f=-1;
		c=getchar();
	}
	while (c>='0' && c<='9') {
		x=x*10+c-'0';
		c=getchar();
	}
	return x*f;
}
bool cmp(node x,node y) {
	if (x.s!=y.s) return x.s>y.s;
	else return x.id<y.id;
}
int main() {
	int n=read();
	for (int i=1; i<=n; i++) {
		int a=read();
		int b=read();
		int c=read();
		int d=read();
		p[i].s=a+b+c+d;
		p[i].id=i;
	}
	sort(p+1,p+n+1,cmp);
	for (int i=1; i<=n; i++) {
		if (p[i].id==1) printf("%d\n", i);
	}
	return 0;
}


#include <cstdio>
#include <cstring>
#include <queue>
#include <cmath>
#include <algorithm>
#include <set>
#include <iostream>
#include <map>
#include <stack>
#include <string>
#include <vector>
#include <bits/stdc++.h>
#define  pi acos(-1.0)
#define  eps 1e-6
#define  fi first
#define  se second
#define  lson l,m,rt<<1
#define  rson m+1,r,rt<<1|1
#define  bug         printf("******\n")
#define  mem(a,b)    memset(a,b,sizeof(a))
#define  fuck(x)     cout<<"["<<x<<"]"<<endl
#define  f(a)        a*a
#define  sf(n)       scanf("%d", &n)
#define  sff(a,b)    scanf("%d %d", &a, &b)
#define  sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define  sffff(a,b,c,d) scanf("%d %d %d %d", &a, &b, &c, &d)
#define  pf          printf
#define  FRE(i,a,b)  for(i = a; i <= b; i++)
#define  FREE(i,a,b) for(i = a; i >= b; i--)
#define  FRL(i,a,b)  for(i = a; i < b; i++)
#define  FRLL(i,a,b) for(i = a; i > b; i--)
#define  FIN         freopen("DATA.txt","r",stdin)
#define  gcd(a,b)    __gcd(a,b)
#define  lowbit(x)   x&-x
#pragma  comment (linker,"/STACK:102400000,102400000")
using namespace std;
typedef long long LL;
const int maxn = 1e6 + 10;
int n;
struct node {
    int a, b, c, d;
} a[maxn];
int main() {
    sf(n);
    int maxx = -1, ans = 0, a, b, c, d;
    for (int i = 1 ; i <= n ; i++) {
        sffff(a, b, c, d);
        if(a + b + c + d >= maxx ) {
            maxx = a + b + c + d;
            ans = i;
        }
    }
    printf("%d\n", ans);
    return 0;
}


#include <cstdio>
#include <cstring>
#include <queue>
#include <cmath>
#include <algorithm>
#include <set>
#include <iostream>
#include <map>
#include <stack>
#include <string>
#include <vector>
#include <bits/stdc++.h>
#define  pi acos(-1.0)
#define  eps 1e-6
#define  fi first
#define  se second
#define  lson l,m,rt<<1
#define  rson m+1,r,rt<<1|1
#define  bug         printf("******\n")
#define  mem(a,b)    memset(a,b,sizeof(a))
#define  fuck(x)     cout<<"["<<x<<"]"<<endl
#define  f(a)        a*a
#define  sf(n)       scanf("%d", &n)
#define  sff(a,b)    scanf("%d %d", &a, &b)
#define  sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define  sffff(a,b,c,d) scanf("%d %d %d %d", &a, &b, &c, &d)
#define  pf          printf
#define  FRE(i,a,b)  for(i = a; i <= b; i++)
#define  FREE(i,a,b) for(i = a; i >= b; i--)
#define  FRL(i,a,b)  for(i = a; i < b; i++)
#define  FRLL(i,a,b) for(i = a; i > b; i--)
#define  FIN         freopen("DATA.txt","r",stdin)
#define  gcd(a,b)    __gcd(a,b)
#define  lowbit(x)   x&-x
#pragma  comment (linker,"/STACK:102400000,102400000")
using namespace std;
typedef long long LL;
const int maxn = 1e6 + 10;
int n;
struct node {
    int a, b, c, d, id, sum;
} a[maxn];
int cmp(node a, node b) {
    if (a.sum == b.sum) return a.id < b.id;
    return a.sum > b.sum;
}
int main() {
    sf(n);
    for (int i = 1 ; i <= n ; i++) {
        sffff(a[i].a, a[i].b, a[i].c, a[i].d);
        a[i].sum = a[i].a + a[i].b + a[i].c + a[i].d;
        a[i].id = i;
    }
    sort(a + 1, a + 1 + n, cmp);
    for (int i = 1 ; i <= n ; i++) {
        if (a[i].id == 1) {
            printf("%d\n", i);
            return 0;
        }
    }
    return 0;
}


#include <cstdio>
#include <cstring>
#include <queue>
#include <cmath>
#include <algorithm>
#include <set>
#include <iostream>
#include <map>
#include <stack>
#include <string>
#include <vector>
#include <bits/stdc++.h>
#define  pi acos(-1.0)
#define  eps 1e-6
#define  fi first
#define  se second
#define  lson l,m,rt<<1
#define  rson m+1,r,rt<<1|1
#define  bug         printf("******\n")
#define  mem(a,b)    memset(a,b,sizeof(a))
#define  fuck(x)     cout<<"["<<x<<"]"<<endl
#define  f(a)        a*a
#define  sf(n)       scanf("%d", &n)
#define  sff(a,b)    scanf("%d %d", &a, &b)
#define  sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define  sffff(a,b,c,d) scanf("%d %d %d %d", &a, &b, &c, &d)
#define  pf          printf
#define  FRE(i,a,b)  for(i = a; i <= b; i++)
#define  FREE(i,a,b) for(i = a; i >= b; i--)
#define  FRL(i,a,b)  for(i = a; i < b; i++)
#define  FRLL(i,a,b) for(i = a; i > b; i--)
#define  FIN         freopen("DATA.txt","r",stdin)
#define  gcd(a,b)    __gcd(a,b)
#define  lowbit(x)   x&-x
#pragma  comment (linker,"/STACK:102400000,102400000")
using namespace std;
typedef long long LL;
const int maxn = 1e6 + 10;
int n;
struct node {
    int a, b, c, d;
} a[maxn];
int main() {
    sf(n);
    int maxx = -1, ans = 0, a, b, c, d;
    for (int i = 1 ; i <= n ; i++) {
        sffff(a, b, c, d);
        if(a + b + c + d > maxx) {
            maxx = a + b + c + d;
            ans = i;
        }
    }
    printf("%d\n", ans);
    return 0;
}


//
//  main.cpp
//  grass
//
//  Created by 张天翼 on 2018/6/14.
//  Copyright © 2018年 张天翼. All rights reserved.
//

#include <iostream>
#include <stdlib.h>
using namespace std;

int a[1000], b[1000], c[1000], d[1000], sm[1000];
int rk[1000];

void swap(int i, int j){
    int tmp;
    tmp = sm[i]; sm[i] = sm[j]; sm[j] = tmp;
    tmp = rk[i]; rk[i] = rk[j]; rk[j] = tmp;
}

bool is_better(int i, int j){
    return (sm[i] > sm[j]) || (sm[i] == sm[j] && rk[i] < rk[j]);
}

int partition(int lo, int hi){
    int pivot = rand() % (hi - lo + 1) + lo;
    swap(pivot, hi);
    int i = lo;
    for(int j=lo; j<hi; j++){
        if(is_better(j, hi)){
            swap(i, j);
            i++;
        }
    }
    swap(i, hi);
    return i;
}

void sort(int lo, int hi){
    if(lo < hi){
        int mid = partition(lo, hi);
        sort(lo, mid-1);
        sort(mid+1, hi);
    }
}

int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        sm[i] = a[i] + b[i] + c[i] + d[i];
        rk[i] = i+1;
    }

    sort(0, n-1);

    for(int i=0; i<n; i++){
        if(rk[i] == 1){
            cout << i+1 << '\n';
            break;
        }
    }
    return 0;
}


//
//  main.cpp
//  grass
//
//  Created by 张天翼 on 2018/6/14.
//  Copyright © 2018年 张天翼. All rights reserved.
//

#include <iostream>
#include <stdlib.h>
using namespace std;

int a[1000], b[1000], c[1000], d[1000], sm[1000];
int rk[1000];

void swap(int i, int j){
    int tmp;
    tmp = sm[i]; sm[i] = sm[j]; sm[j] = tmp;
    tmp = rk[i]; rk[i] = rk[j]; rk[j] = tmp;
}

bool is_better(int i, int j){
    return (sm[i] > sm[j]) || (sm[i] == sm[j] && i < j);
}

int partition(int lo, int hi){
    int pivot = rand() % (hi - lo + 1) + lo;
    swap(pivot, hi);
    int i = lo;
    for(int j=lo; j<hi; j++){
        if(is_better(j, hi)){
            swap(i, j);
            i++;
        }
    }
    swap(i, hi);
    return i;
}

void sort(int lo, int hi){
    if(lo < hi){
        int mid = partition(lo, hi);
        sort(lo, mid-1);
        sort(mid+1, hi);
    }
}

int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        sm[i] = a[i] + b[i] + c[i] + d[i];
        rk[i] = i+1;
    }

    sort(0, n-1);

    cout << rk[0] << '\n';
    return 0;
}


#include <bits/stdc++>
using namespace std;
int main ()
{
    int n,c=0;
    int w,x,y,z;
    cin>>n;
    int sum[n]={0};
    for (int i=0;i<n;i++)
    {
        cin>>w>>x>>y>>z;
        sum[i]=sum[i]+w+x+y+z;

    }
    c=sum[0];
    sort (sum,sum+n);
    for (int i=1;i<=n;i++){
    if (c>=sum[n-i])
    cout<<i;
    break;
    }
  return 0;


#include <bits/stdc++>
using namespace std;
int main ()
{
    int n,sum=0,c;
    int w,x,y,z;
    cin>>n;
    int sum[n];
    for (int i=0;i<n;i++)
    {
        cin>>w>>x>>y>>z;
        sum[i]=sum[i]+w+x+y+z;

    }
    c=sum[0];
    sort (sum,sum+n);
    for (int i=1;i<=n;i++){
    if (c>=sum[n-i])
    cout<<i;
    break;
    }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main ()
{
    int n,c=0;
    int w,x,y,z;
    cin>>n;
    int sum[n];
    for (int i=0;i<n;i++)
    {
        cin>>w>>x>>y>>z;
        sum[i]=w+x+y+z;

    }
    c=sum[0];
    sort (sum,sum+n);
    for (int i=1;i<=n;i++){
    if (c>=sum[n-i])
    cout<<i;
    break;}

  return 0;
    }


#include <bits/stdc++.h>
using namespace std;
int main ()
{
    int n,c=0;
    int w,x,y,z;
    cin>>n;
    int sum[n]={0};
    for (int i=0;i<n;i++)
    {
        cin>>w>>x>>y>>z;
        sum[i]=sum[i]+w+x+y+z;

    }
    c=sum[0];
    sort (sum,sum+n);
    for (int i=1;i<=n;i++){
    if (c>=sum[n-i])
    cout<<i;
    break;
    }
  return 0;


#include <bits/stdc++.h>
using namespace std;
int main ()
{
    int n,c=0;
    int w,x,y,z;
    cin>>n;
    int sum[n]={0};
    for (int i=0;i<n;i++)
    {
        cin>>w>>x>>y>>z;
        sum[i]=sum[i]+w+x+y+z;

    }
    c=sum[0];
    sort (sum,sum+n);
    for (int i=1;i<=n;i++){
    if (c>=sum[n-i])
    cout<<i;
    break;}

  return 0;
    }


#include <bits/stdc++.h>
using namespace std;
int main ()
{
    int n,c=0;
    int w,x,y,z;
    cin>>n;
    int sum[n]={0};
    for (int i=0;i<n;i++)
    {
        cin>>w>>x>>y>>z;
        sum[i]=sum[i]+w+x+y+z;

    }
    c=sum[0];
    sort (sum,sum+n);
    for (int i=1;i<=n;i++){
    if (c>=sum[n-i]){
    cout<<i;
    break;}
    }
  return 0;
    }