output_description: Print `Yes` if it is possible to make N arrays exactly the same after
  performing the Q operations. Otherwise, print `No`.
  
  * * *
input_description: The input is given from Standard Input in the following format:
  
      
      
      N M
      Q
      a_1 a_2 ... a_Q
attempt: from collections import defaultdict
  def ReadInput():
  	return [int(a) for a in input().split(' ')]
  (N, M) = ReadInput()
  Q = int(input())
  Array = ReadInput()
  def ifEqual(x):
  	temp = None
  	for i in x:
  		if (temp == None):	
  			temp = x[i]
  			continue
  		elif (x[i] != temp):
  			print('ifEqual is 0')
  			return 0
  	return temp
  def check(Array, N, M, *args):
  	Count = defaultdict(int)
  	Array.reverse()
  	if ("reverse") not in args:
  		for i in Array:
  			if (i == 1 or Count[i] < Count[i-1]):
  				Count[i] += 1
  			else:	
  				return 0
  		Count.pop(N)
  		if(ifEqual(Count)):
  			return 1
  		else:
  			return 0
  	else:
  		for i in Array:
  			if (i == N or Count[i] < Count[i+1]):
  				Count[i] += 1
  			else:
  				return 0
  		Count.pop(1)
  		if(ifEqual(Count) >= M):
  			return 1
  		else
  			return 0
  if (check(Array, N, M) or check(Array, N, M, "reverse")):
  	print("Yes")
  else:
  	print("No")
  
problem_description: Statement
  
  There are N arrays. The length of each array is M and initially each array
  contains integers (1，2，...，M) in this order.
  
  Mr. Takahashi has decided to perform Q operations on those N arrays. For the
  i-th (1≤i≤Q) time, he performs the following operation.
  
    * Choose an arbitrary array from the N arrays and move the integer a_i (1≤a_i≤M) to the front of that array. For example, after performing the operation on a_i=2 and the array (5，4，3，2，1), this array becomes (2，5，4，3，1).
  
  Mr. Takahashi wants to make N arrays exactly the same after performing the Q
  operations. Determine if it is possible or not.
samples: [{"input": "2 2\n    3\n    2 1 2", "output": "Yes\n    \n\nYou can perform the operations as follows.\n\n![](/img/other/code_festival_2016_quala/gbanjthabot/E_0.png)\n\n* * *"}, {"input": "3 2\n    3\n    2 1 2", "output": "No\n    \n\n* * *"}, {"input": "2 3\n    3\n    3 2 1", "output": "Yes\n    \n\nYou can perform the operations as follows.\n\n![](/img/other/code_festival_2016_quala/gbanjthabot/E_2.png)\n\n* * *"}, {"input": "3 3\n    6\n    1 2 2 3 3 3", "output": "No"}]