import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ // TODO Auto-generated method stub Scanner Sc=new Scanner(System.in); int maxy=Integer.MIN_VALUE; int maxx=Integer.MIN_VALUE; int sumx=0; int sumy=0; int q=Sc.nextInt(); int x[]=new int[1000]; int y[]=new int[1000]; for(int i=1;i<=q;i++) { int n=Sc.nextInt(); for( int j=0;jmaxy) { maxy=y[j]; } if(x[j]>maxx) { maxx=x[j]; } } int maxsum=maxx+maxy; if((sumx+sumy)==(2*maxsum)) { System.out.println("YES"); } else { System.out.println("NO"); } } } }