import sys
def stackQue(n,ls):
if len(ls)!=n:
return False
i=0
while i<len(ls):
tmpl=[c for c in ls[i:] if ls[i]>c]
if not isSort(tmpl):
return False
i+=1
return True
def isSort(ls,reverse=False):
if not reverse:
i=0
while i<len(ls)-1:
if ls[i]<ls[i+1]:
return False
i+=1
return True
i = 0
for line in sys.stdin:
a = line.split()
n = len(a)
ls = map(lambda x:int(x),a)
if n == 1 and ls[0]==1:
i +=1
if i%2 == 0:
print 'Yes'
if 1< n <= 100:
re = stackQue(n,ls)
if re is True:
print 'Yes'
else:
print 'No'
/**************************************************************
Problem: 2119
User: admin
Language: Python
Result: Wrong Answer
****************************************************************/