Devu and Churu love to play games a lot. Today, they have an array A consisting of N positive integers. First they listed all N × (N+1) / 2 non-empty continuous subarrays of the array A on a piece of paper and then replaced all the subarrays on the paper with the maximum element present in the respective subarray.
Devu and Churu decided to play a game with numbers on the paper. They both have decided to make moves turn by turn. In one turn, the player picks some number from the list and discards that number. The one who is not able to make a valid move will be the loser. To make the game more interesting, they decided to put some constraints on their moves.
A constraint on a game can be any of following three types :
-  > K : They are allowed to choose numbers having values strictly greater than K only.
-  < K : They are allowed to choose numbers having values strictly less than K only.
-  = K : They are allowed to choose numbers having values equal to K only.

Given M constraints and who goes first, you have to tell the outcome of each game. Print 'D' if Devu wins otherwise print 'C' without quotes.
Note that M games are independent, that is, they'll rewrite numbers by using array A after each game. (This is the task for the loser of the previous game!)

-----Input -----
First line of input contains two space separated integers N and M denoting the size of array A and number of game played by them. Next line of input contains N space-separated integers denoting elements of array A. Each of the next M lines of input contains three space-separated parameters describing a game. First two parameter are a character C ∈ {<, >, =} and an integer K denoting the constraint for that game. The last parameter is a character X ∈ {D, C} denoting the player who will start the game. 

----- Output -----
Output consists of a single line containing a string of length M made up from characters D and C only, where ith character in the string denotes the outcome of the ith game.

----- Constraints: -----
- 1 ≤ N, M ≤ 106
- 1 ≤ Ai, K ≤ 109 
- X ∈ {D, C}
- C ∈ {<, >, =}

-----Subtasks: -----
- Subtask 1 : 1 ≤ N, M ≤ 104 : ( 20 pts )
- Subtask 2 : 1 ≤ N, M ≤ 105 : ( 30 pts )
- Subtask 3 : 1 ≤ N, M ≤ 106 : ( 50 pts )

-----Example:-----
Input:
3 5
1 2 3
> 1 D
< 2 C
= 3 D
> 4 C
< 5 D

Output:
DCDDC

-----Explanation: -----
Subarray List :
- [1]

- [2]

- [3]

- [1,2]

- [2,3]

- [1,2,3]

Numbers on the paper after replacement :

- [1]

- [2]

- [3]

- [2]

- [3]

- [3]

Game 1 : There are only 5 numbers > 1 in the list.
Game 2 : There is only 1 number < 2 in the list.
Game 3 : There are only 3 numbers = 3 in the list.
Game 4 : There are no numbers > 4 in the list. So the first player cannot make his move.
Game 5 : There are 6 numbers < 5 in the list.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'def left_span(arr,n):\n ans=[0]\n span=[0]\n for i in range(1,n):\n  \n  while span and arr[i]>arr[span[-1]]:\n   span.pop()\n  \n  if not span:\n   ans.append(0)\n   \n  else:\n   ans.append(span[-1]+1)\n  span.append(i)\n return ans\n\ndef right_span(arr,n):\n ans=[n+1]\n span=[n-1]\n for i in range(n-2,-1,-1):\n  \n  while span and arr[i]>=arr[span[-1]]:\n   span.pop()\n   \n  if not span:\n   ans.append(n+1)\n  else:\n   ans.append(span[-1]+1)\n  span.append(i)\n return ans[::-1]\nfrom collections import Counter\nfrom bisect import bisect_left,bisect_right\nfrom operator import itemgetter\nn,q=list(map(int,input().split( )))\narr=list(map(int,input().split( )))\n\nleft=left_span(arr,n)\nright=right_span(arr,n)\nc=Counter()\nfor i in range(n):\n c[arr[i]]+=(right[i]-(i+1))*(i+1-left[i])\na=sorted(c)\nf=[]\nfor v in a:\n f.append(c[v])\nprefix_sum=[f[0]]\nn=len(f)\nfor i in range(1,n):\n prefix_sum.append(f[i]+prefix_sum[-1])\nr=[0]*q\nfor i in range(q):\n sign,k,player=list(map(str,input().split( )))\n k=int(k)\n if sign=="=":\n  if k in c:\n   res=c[k]\n  else:\n   res=0\n elif sign==">":\n  j=bisect_left(a,k)\n  if j==n:\n   res=0\n  elif a[j]==k:\n   res=prefix_sum[-1] - prefix_sum[j]\n  else:\n   if j>0:\n    res=prefix_sum[-1] - prefix_sum[j-1]\n   else:\n    res=prefix_sum[-1]\n else:\n  j=bisect_left(a,k)\n  if j==0:\n   res=0\n  else:\n   res=prefix_sum[j-1]\n \n if res%2==0:\n  if player=="D":\n   r[i]="C"\n  else:\n   r[i]="D"\n else:\n  r[i]=player\nprint(\'\'.join(r))\n   \n  \n\n\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 14831