Vladik had started reading a complicated book about algorithms containing n pages. To improve understanding of what is written, his friends advised him to read pages in some order given by permutation P = [p_1, p_2, ..., p_{n}], where p_{i} denotes the number of page that should be read i-th in turn.

Sometimes Vladik’s mom sorted some subsegment of permutation P from position l to position r inclusive, because she loves the order. For every of such sorting Vladik knows number x — what index of page in permutation he should read. He is wondered if the page, which he will read after sorting, has changed. In other words, has p_{x} changed? After every sorting Vladik return permutation to initial state, so you can assume that each sorting is independent from each other.


-----Input-----

First line contains two space-separated integers n, m (1 ≤ n, m ≤ 10^4) — length of permutation and number of times Vladik's mom sorted some subsegment of the book.

Second line contains n space-separated integers p_1, p_2, ..., p_{n} (1 ≤ p_{i} ≤ n) — permutation P. Note that elements in permutation are distinct.

Each of the next m lines contains three space-separated integers l_{i}, r_{i}, x_{i} (1 ≤ l_{i} ≤ x_{i} ≤ r_{i} ≤ n) — left and right borders of sorted subsegment in i-th sorting and position that is interesting to Vladik.


-----Output-----

For each mom’s sorting on it’s own line print "Yes", if page which is interesting to Vladik hasn't changed, or "No" otherwise.


-----Examples-----
Input
5 5
5 4 3 2 1
1 5 3
1 3 1
2 4 3
4 4 4
2 5 3

Output
Yes
No
Yes
Yes
No

Input
6 5
1 4 3 2 5 6
2 4 3
1 6 2
4 5 4
1 3 3
2 6 3

Output
Yes
No
Yes
No
Yes



-----Note-----

Explanation of first test case:   [1, 2, 3, 4, 5] — permutation after sorting, 3-rd element hasn’t changed, so answer is "Yes".  [3, 4, 5, 2, 1] — permutation after sorting, 1-st element has changed, so answer is "No".  [5, 2, 3, 4, 1] — permutation after sorting, 3-rd element hasn’t changed, so answer is "Yes".  [5, 4, 3, 2, 1] — permutation after sorting, 4-th element hasn’t changed, so answer is "Yes".  [5, 1, 2, 3, 4] — permutation after sorting, 3-rd element has changed, so answer is "No".

Source: codeforces | Difficulty: EASY
Tags: Sorting

Implementation


Solutions:
(n, m) = list(map(int, input().split()))
p = list(map(int, input().split()))
for _ in range(m):
	(l, r, x) = map(int, input().split())
	l -= 1
	r -= 1
	x -= 1
	a = 0
	t = p[x]
	for i in range(l, r + 1):
		a += p[i] < t
	if a == x - l:
		print('Yes')
	else:
		print('No')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
d = dict()
for _ in range(m):
	(l, r, x) = map(int, input().split())
	if x > r or x < l:
		print('Yes')
	else:
		b = a[l - 1:r]
		res = 0
		for item in b:
			if item < a[x - 1]:
				res += 1
		if res == x - l:
			print('Yes')
		else:
			print('No')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
for i in range(m):
	(l, r, x) = map(int, input().split())
	if x < l or x > r:
		print('Yes')
	else:
		cnt = 0
		for j in range(l, r + 1):
			cnt += a[j - 1] < a[x - 1]
		if l + cnt == x:
			print('Yes')
		else:
			print('No')


import math
import bisect
(n, m) = map(int, input().split())
P = [int(c) for c in input().split()]
b_len = math.ceil(math.sqrt(n))
b = []
for i in range(1000):
	b.append(sorted(P[i * b_len:(i + 1) * b_len]))
	if n <= (i + 1) * b_len:
		break
b_cnt = len(b)
for i in range(m):
	(l, r, x) = map(int, input().split())
	l_b = (l - 1) // b_len
	r_b = (r - 1) // b_len
	if r_b - l_b <= 1:
		sorted_a = sorted(P[l - 1:r])
		print('Yes' if P[x - 1] == sorted_a[x - 1 - (l - 1)] else 'No')
	else:
		_a = sorted(P[l - 1:(l_b + 1) * b_len] + P[r_b * b_len:r])
		idx = bisect.bisect_left(_a, P[x - 1])
		for j in range(l_b + 1, r_b):
			idx += bisect.bisect_left(b[j], P[x - 1])
		print('Yes' if idx + l == x else 'No')


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(m):
	(l, r, x) = [int(x) - 1 for x in input().split()]
	for j in range(l, r + 1):
		if a[j] < a[x]:
			l += 1
			if l > x:
				break
	if l == x:
		print('Yes')
	else:
		print('No')


(x, y) = list(map(int, input().split()))
t = 0
awan = list(map(int, input().split()))
for v in range(0, y):
	(l, r, x) = list(map(int, input().split()))
	l -= 1
	x -= 1
	t = 0
	for j in range(l, r):
		if awan[x] > awan[j]:
			t += 1
	if l + t == x:
		print('Yes')
	else:
		print('No')


int_inp = lambda : int(input())
strng = lambda : input().strip()
strl = lambda : list(input().strip())
mul = lambda : map(int, input().split())
mulf = lambda : map(float, input().split())
seq = lambda : list(map(int, input().split()))
import math
from collections import Counter, defaultdict
(m, n) = map(int, input().split())
b = list(map(int, input().split()))
for i in range(n):
	(l, r, x) = map(int, input().split())
	cnt = 0
	for j in range(l - 1, r):
		if b[j] < b[x - 1]:
			cnt += 1
	if cnt == x - l:
		print('Yes')
	else:
		print('No')


(a, b) = map(int, input().split())
p = list(map(int, input().split()))
for i in range(b):
	(l, r, x) = map(int, input().split())
	l -= 1
	r -= 1
	x -= 1
	ans = 0
	for i in range(l, r + 1):
		if p[i] <= p[x]:
			ans += 1
	if ans == x - l + 1:
		print('Yes')
	else:
		print('No')


(n, k) = map(int, input().split())
l = input()
z = [int(i) for i in l.split()]
for i in range(k):
	(l, r, x) = map(int, input().split())
	(l, r, x) = (l - 1, r - 1, x - 1)
	y = 0
	t = z[x]
	for j in range(l, r + 1):
		if z[j] < t:
			y += 1
	if l + y == x:
		print('Yes')
	else:
		print('No')


import sys
(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
for line in sys.stdin:
	(l, r, x) = map(int, line.split())
	cnt = 0
	for i in range(l - 1, r):
		if arr[i] < arr[x - 1]:
			cnt += 1
	if cnt == x - l:
		print('Yes')
	else:
		print('No')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
for _ in range(m):
	(l, r, x) = map(int, input().split())
	id = l - 1
	for i in range(l - 1, r):
		if a[x - 1] > a[i]:
			id += 1
	print('YNeos'[a[x - 1] != a[id]::2])


from sys import maxsize, stdout, stdin, stderr
import re
tup = lambda : map(int, stdin.readline().split())
I = lambda : int(stdin.readline())
lint = lambda : [int(x) for x in stdin.readline().split()]
S = lambda : stdin.readline().replace('\n', '').strip()

def grid(r, c):
	return [lint() for i in range(r)]

def debug(*args, c=6):
	print('\x1b[3{}m'.format(c), *args, '\x1b[0m', file=stderr)

def bina(x, ls):
	lo = 0
	high = len(ls) - 1
	while lo <= high:
		mid = (lo + high) // 2
		if ls[mid] == x:
			return mid
		elif ls[mid] < x:
			lo = mid + 1
		else:
			high = mid - 1
	return -1
(n, m) = tup()
ls = lint()
for _ in range(m):
	(l, r, x) = tup()
	cnt = 0
	for i in range(l - 1, r):
		if ls[i] < ls[x - 1]:
			cnt += 1
	if cnt == x - l:
		print('Yes')
	else:
		print('No')


(a, b) = input().split()
a = int(a)
b = int(b)
seq = input().split()
for i in range(0, a):
	seq[i] = int(seq[i])
for case in range(0, b):
	(l, r, x) = input().split()
	l = int(l)
	r = int(r)
	x = int(x)
	cnt = 0
	for j in range(l - 1, r):
		if seq[j] < seq[x - 1]:
			cnt += 1
	if cnt == x - l:
		print('Yes')
	else:
		print('No')


arri = lambda : [int(s) for s in input().split()]
(n, m) = arri()
p = arri()
ans = []
for i in range(m):
	(l, r, x) = arri()
	no = l - 1
	cur = p[x - 1]
	for i in range(l - 1, r):
		if p[i] < cur:
			no -= -1
	ans.append('Yes' if no == x - 1 else 'No')
print('\n'.join(ans))


import sys
import string
from collections import Counter, defaultdict
from math import fsum, sqrt, gcd, ceil, factorial
from operator import add
inf = float('inf')
flush = lambda : sys.stdout.flush
comb = lambda x, y: factorial(x) // factorial(y) // factorial(x - y)
ip = lambda : input()
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())
(n, k) = r()
arr = rr()
for _ in range(k):
	(a, b, c) = r()
	d = 0
	for i in range(a - 1, b):
		d += arr[i] < arr[c - 1]
	print('Yes' if d == c - a else 'No')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
for _ in range(m):
	(l, r, x) = map(int, input().split())
	k = a[x - 1]
	if l - 1 <= x - 1 <= r - 1:
		b = a[l - 1:r]
		i = b.index(k)
		c = 0
		for j in range(0, len(b)):
			if b[j] < k:
				c += 1
		if c == i:
			print('Yes')
		else:
			print('No')
	else:
		print('Yes')


def case(p, l, r, x):
	l -= 1
	r -= 1
	x -= 1
	a = 0
	t = p[x]
	for i in range(l, r + 1):
		if p[i] < t:
			a += 1
	if a == x - l:
		return 'Yes'
	else:
		return 'No'

def __starting_point():
	(n, m) = list(map(int, input().split()))
	p = [int(i) for i in input().split()]
	for i in range(m):
		(l, r, x) = list(map(int, input().split()))
		print(case(p, l, r, x))
__starting_point()


(n, m) = list(map(int, input().split()))
p = list(map(int, input().split()))
for _ in range(m):
	(l, r, x) = list(map(int, input().split()))
	px = p[x - 1]
	cnt = l
	for i in range(l, r + 1):
		if p[i - 1] < px:
			cnt += 1
	if cnt == x:
		print('Yes')
	else:
		print('No')


from collections import deque as de
import math
from collections import Counter as cnt
from functools import reduce
from typing import MutableMapping

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

class My_stack:

	def __init__(self):
		self.data = []

	def my_push(self, x):
		return self.data.append(x)

	def my_pop(self):
		return self.data.pop()

	def my_peak(self):
		return self.data[-1]

	def my_contains(self, x):
		return self.data.count(x)

	def my_show_all(self):
		return self.data

	def isEmpty(self):
		return len(self.data) == 0
arrStack = My_stack()

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def get_prime_factors(number):
	prime_factors = []
	while number % 2 == 0:
		prime_factors.append(2)
		number = number / 2
	for i in range(3, int(math.sqrt(number)) + 1, 2):
		while number % i == 0:
			prime_factors.append(int(i))
			number = number / i
	if number > 2:
		prime_factors.append(int(number))
	return prime_factors

def get_frequency(list):
	dic = {}
	for ele in list:
		if ele in dic:
			dic[ele] += 1
		else:
			dic[ele] = 1
	return dic

def Log2(x):
	return math.log10(x) / math.log10(2)

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))
(n, m) = map(int, input().split())
dic = {}
p = []
for (index, value) in enumerate(input().split()):
	dic[index + 1] = int(value)
	p.append(int(value))
while m:
	m -= 1
	(l, r, x) = map(int, input().split())
	cnt = 0
	temp = dic[x]
	for i in range(l - 1, r):
		if p[i] < temp:
			cnt += 1
	if l + cnt != x:
		print('No')
	else:
		print('Yes')


from sys import stdin, stdout

def main():
	(n, m) = [int(_) for _ in input().split()]
	p = [int(_) for _ in input().split()]
	for i in range(m):
		(l, r, x) = [int(_) for _ in input().split()]
		l -= 1
		r -= 1
		x -= 1
		val = p[x]
		smaller = 0
		for j in range(l, r + 1):
			if p[j] < val:
				smaller += 1
		if smaller == x - l:
			stdout.write('Yes' + '\n')
		else:
			stdout.write('No' + '\n')

def __starting_point():
	main()
__starting_point()


def get_min(p, l, r, x):
	v = p[x - 1]
	c = 0
	for i in range(l - 1, r):
		if p[i] < v:
			c += 1
	if c == x - l:
		return True
	else:
		return False
(n, m) = map(int, input().split())
p = list(map(int, input().split()))
for _ in range(m):
	(l, r, x) = map(int, input().split())
	if x <= r and x >= l:
		if get_min(p, l, r, x):
			print('Yes')
		else:
			print('No')
	else:
		print('No')


(n, m) = map(int, input().split())
pages = [int(bruh) for bruh in input().split()]
for plat in range(m):
	(l, r, x) = map(int, input().split())
	pages1 = pages[l - 1:r]
	cnt = 0
	for page in pages1:
		if page < pages[x - 1]:
			cnt += 1
	if cnt + l == x:
		print('Yes')
	else:
		print('No')


from sys import stdin, stdout
import math
from collections import Counter, deque
L = lambda : list(map(int, stdin.readline().strip().split()))
M = lambda : map(int, stdin.readline().strip().split())
I = lambda : int(stdin.readline().strip())
S = lambda : stdin.readline().strip()
C = lambda : stdin.readline().strip().split()
mod = 1000000007

def pr(a):
	return ''.join(list(map(str, a)))

def solve():
	(n, m) = M()
	a = L()
	for i in range(m):
		(l, r, x) = M()
		c = 0
		for j in range(l - 1, r):
			if a[x - 1] > a[j]:
				c += 1
		if l + c == x:
			print('Yes')
		else:
			print('No')
for _ in range(1):
	solve()


from sys import stdin, stdout
(n, m) = map(int, stdin.readline().split())
p = list(map(int, stdin.readline().split()))
for _ in range(m):
	gre = 0
	sma = 0
	(l, r, x) = map(int, stdin.readline().split())
	for i in range(l - 1, r):
		if i < x - 1:
			if p[i] > p[x - 1]:
				gre += 1
		elif i > x - 1:
			if p[i] < p[x - 1]:
				sma += 1
	if gre != sma:
		stdout.write('No \n')
	else:
		stdout.write('Yes \n')


import math
import collections
import bisect

def arrPrint(a):
	return ' '.join([str(i) for i in a])

def gridPrint(a):
	return '\n'.join([' '.join([str(j) for j in a[i]]) for i in range(len(a))])

def isPalindrome(s):
	for i in range(len(s) // 2):
		if not s[i] == s[-i - 1]:
			return False
	return True

def solve(p, l, r, x):
	curr = p[x - 1]
	less = 0
	for i in range(l - 1, r):
		if p[i] < curr:
			less += 1
	if l + less == x:
		return 'Yes'
	return 'No'
(n, m) = [int(s) for s in input().split()]
p = [int(s) for s in input().split()]
for m in range(m):
	(l, r, x) = [int(s) for s in input().split()]
	result = solve(p, l, r, x)
	print(result)


(n, m) = map(int, input().split())
p = [int(i) for i in input().split()]
for _ in range(m):
	(l, r, x) = map(int, input().split())
	counter = 0
	for ind in range(l - 1, r):
		if p[ind] < p[x - 1]:
			counter += 1
	print('Yes' if l + counter == x else 'No')


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
import time
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string
start_time = time.time()

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def getMat(n):
	return [getInts() for _ in range(n)]

def get_ints():
	return map(int, sys.stdin.readline().split())
(n, m) = map(int, input().split())
ar = list(get_ints())
for i in range(m):
	(a, b, x) = map(int, input().split())
	if a > x or b < x:
		print('Yes')
	else:
		ele = ar[x - 1]
		c = 0
		for j in range(a - 1, b):
			if ele > ar[j]:
				c += 1
		if a + c == x:
			print('Yes')
		else:
			print('No')


(n, m) = list(map(int, input().split()))
p = list(map(int, input().split()))
for i in range(m):
	(l, r, x) = list(map(int, input().split()))
	q = p[x - 1]
	c = 0
	for j in range(l - 1, r):
		if q > p[j]:
			c = c + 1
	if l + c == x:
		print('Yes')
	else:
		print('No')


(n, m) = map(int, input().strip().split())
a = input()
b = list(map(int, a.strip().split()))
for i in range(m):
	(L, R, k) = map(int, input().strip().split())
	L -= 1
	R -= 1
	k -= 1
	sum = 0
	j = L
	while j <= R:
		if b[j] < b[k]:
			sum += 1
		j += 1
	if sum == k - L:
		print('Yes')
	else:
		print('No')


import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
p = list(map(int, input().split()))
for _ in range(m):
	(l, r, x) = map(int, input().split())
	cnt = 0
	for i in range(l - 1, r):
		if p[i] < p[x - 1]:
			cnt += 1
	if cnt == x - l:
		print('Yes')
	else:
		print('No')


(n, t) = map(int, input().split())
P = list(map(int, input().split()))
res = []
for i in range(t):
	(l, r, x) = map(int, input().split())
	item = P[x - 1]
	count = 0
	for i in range(l - 1, r):
		if P[i] < item:
			count += 1
	new_item = P[l - 1 + count]
	if item != new_item and x <= r and (x >= l):
		res.append('No')
	else:
		res.append('Yes')
print('\n'.join(map(str, res)))


from math import *
from bisect import *
from collections import Counter, defaultdict
from sys import stdin, stdout
input = stdin.readline
I = lambda : int(input())
SI = lambda : input()
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
(n, k) = M()
a = LI()
for i in range(k):
	(l, r, x) = M()
	c = 0
	for j in range(l - 1, r):
		if a[j] < a[x - 1]:
			c += 1
	if l + c == x:
		print('Yes')
	else:
		print('No')


import math
for _ in range(1):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	for i in range(k):
		cnt = 0
		(a, b, c) = map(int, input().split())
		for j in range(a - 1, b):
			if l[j] < l[c - 1]:
				cnt += 1
		if cnt + a == c:
			print('Yes')
		else:
			print('No')


import math as mt
import sys, string, bisect
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
d = defaultdict(list)
(n, m) = M()
l = L()
for i in range(m):
	(le, r, p) = M()
	c = 0
	for j in range(le - 1, r):
		if l[j] < l[p - 1]:
			c += 1
	if le + c == p:
		print('Yes')
	else:
		print('No')


(n, m) = map(int, input().split())
P = list(map(int, input().split()))
R = [0] * n
L = [0] * n
for i in range(m):
	(l, r, x) = map(int, input().split())
	(l, r, x) = (l - 1, r - 1, x - 1)
	tmp = 0
	for j in range(l, x):
		if P[j] > P[x]:
			tmp += 1
	for j in range(x, r + 1):
		if P[j] < P[x]:
			tmp -= 1
	if tmp == 0:
		print('Yes')
	else:
		print('No')


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
for _ in range(m):
	(l, r, x) = map(int, input().split())
	c = a[l - 1:r]
	s = 0
	for i in range(len(c)):
		if i < x - l:
			if c[i] > c[x - l]:
				s += 1
		elif i > x - l:
			if c[i] < c[x - l]:
				s -= 1
	if s == 0:
		print('Yes')
	else:
		print('No')


(n, m) = map(int, input().split())
p = list(map(int, input().split()))
for _ in range(m):
	(l, r, x) = map(int, input().split())
	y = p[x - 1]
	c = 0
	for z in range(l - 1, r):
		if p[z] < y:
			c += 1
	print('Yes' if c == x - l else 'No')


from sys import stdin
from bisect import bisect, insort

def main():
	(n, m) = map(int, input().split())
	pp = list(map(int, input().split()))
	res = stdin.read().splitlines()
	(d, buf) = ({}, [])
	for (i, s) in enumerate(res):
		(l, r, x) = map(int, s.split())
		l -= 1
		p = pp[x - 1]
		d[l, p] = 0
		d[r, p] = 0
		res[i] = (l, r, x, p)
	pp.reverse()
	for (i, p) in sorted(d.keys()):
		while len(buf) < i:
			insort(buf, pp.pop())
		d[i, p] = bisect(buf, p)
	for i in range(m):
		(l, r, x, p) = res[i]
		res[i] = ('No', 'Yes')[x - l == d[r, p] - d[l, p]]
	print('\n'.join(res))
main()


def partition(a, start, end):
	pivot = a[end]
	pindex = start
	for i in range(start, end):
		if a[i] < pivot:
			(a[i], a[pindex]) = (a[pindex], a[i])
			pindex += 1
	return pindex
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
for _ in range(m):
	(l, r, x) = map(int, input().split())
	k = a[x - 1]
	if l - 1 <= x - 1 <= r - 1:
		b = a[l - 1:r]
		i = b.index(k)
		b.remove(k)
		b.append(k)
		ans = partition(b, 0, len(b) - 1)
		if ans == i:
			print('Yes')
		else:
			print('No')
	else:
		print('Yes')


(n, m) = list(map(int, input().split()))
p = list(map(int, input().split()))
for _ in range(m):
	(l, r, x) = map(int, input().split())
	l -= 1
	r -= 1
	x -= 1
	t = p[x]
	a = sum(map(lambda s: s < t, p[l:r + 1]))
	if a == x - l:
		print('Yes')
	else:
		print('No')


import collections
import itertools
from functools import reduce
mod = 10 ** 9 + 7

def permutationbysum():
	for _ in range(int(input())):
		(num, l, r, achieve) = map(int, input().split())
		k = r - l + 1
		if k * (k + 1) // 2 <= achieve <= k * (num * 2 + 1 - k) // 2:
			outpos = r % num
			inpos = l - 1
			ans = [0] * num
			for i in range(num, 0, -1):
				if achieve - i > 0 or (achieve - i == 0 and inpos == r - 1):
					achieve -= i
					ans[inpos] = i
					inpos += 1
				else:
					ans[outpos] = i
					outpos += 1
					outpos %= num
			print(*ans)
		else:
			print(-1)

def peaks():
	for _ in range(int(input())):
		(num, peak) = map(int, input().split())
		pos = 1
		rpos = num
		ans = []
		now = 0
		if num == 1:
			if not peak:
				print(1)
			else:
				print(-1)
			continue
		if num == 2:
			if peak:
				print(-1)
			else:
				print(1, 2)
			continue
		added = 0
		while rpos + 1 != pos:
			if not peak:
				while pos <= rpos:
					ans.append(pos)
					pos += 1
				break
			if not now:
				ans.append(pos)
				pos += 1
			else:
				ans.append(rpos)
				rpos -= 1
				if num - added != 1:
					peak -= 1
			added += 1
			now = 1 - now
		if peak:
			print(-1)
			continue
		print(*ans)
import sys
input = sys.stdin.readline

def addone():
	for _ in range(int(input())):
		(num, changes) = input().split()
		l = collections.deque(sorted([int(i) for i in num]))
		perm = collections.deque()
		changes = int(changes)
		cd = 0
		ans = len(num)
		while True:
			nextnum = l.pop()
			while perm and perm[-1] == nextnum:
				l.append(perm.pop())
			c = 10 - nextnum - cd
			changes -= c
			cd += c
			if changes >= 0:
				if not c:
					perm.appendleft(1 - cd)
					l.appendleft(-cd)
				else:
					l.appendleft(1 - cd)
					l.appendleft(-cd)
				ans += 1
			else:
				break
		print(ans % 1000000007)
import math

def andsequences():

	def mapping(num):
		nonlocal mnum
		nonlocal c
		num = int(num)
		if num < mnum:
			mnum = num
			c = 1
		elif num == mnum:
			c += 1
		return num
	mod = 1000000007
	for _ in range(int(input())):
		mnum = float('inf')
		c = 0
		num = int(input())
		l = list(map(mapping, input().split()))
		for i in l:
			if mnum & i != mnum:
				print(0)
				break
		else:
			if c == 1:
				print(0)
			else:
				print(math.factorial(num - 2) * (c - 1) * c % mod)

def numberdigit():
	n = 10 ** 5 * 2
	l = [0] * 11
	mod = 10 ** 9 + 7
	l[0] = l[1] = l[2] = l[3] = l[4] = l[5] = l[6] = l[7] = l[8] = 2
	l[9] = 3
	l[10] = 4
	for i in range(11, n):
		l.append((l[i - 10] + l[i - 9]) % mod)
	for _ in range(int(input())):
		(num, c) = input().split()
		c = int(c)
		ans = 0
		for i in num:
			i = int(i)
			if 10 - i > c:
				ans += 1
			else:
				ans += l[c - (10 - i)]
		print(ans % mod)

def mushroom():
	(people, t1, t2, percent) = map(int, input().split())
	l = []
	percent = 1 - percent * 0.01
	for i in range(1, people + 1):
		(s, s1) = map(int, input().split())
		l.append([i, max(s * t1 * percent + s1 * t2, s1 * t1 * percent + s * t2)])
	l.sort(key=lambda x: x[1], reverse=True)
	for i in l:
		i[1] = '{:.2f}'.format(i[1])
		print(*i)

def escape():
	prins = int(input())
	dra = int(input())
	start = int(input())
	pack = int(input())
	c = int(input())
	speeddiff = dra - prins
	if speeddiff <= 0:
		return 0
	pd = start * prins
	ans = 0
	while pd < c:
		hs = pd / speeddiff
		pd += prins * hs
		if pd >= c:
			break
		time = pd / dra
		time += pack
		pd += prins * time
		ans += 1
	return ans

def perm():

	def high(n, k):
		return k * (2 * n - k + 1) // 2

	def low(k):
		return k * (k + 1) // 2
	for _ in range(int(input())):
		(num, lef, rig, s) = map(int, input().split())
		k = rig - lef + 1
		(rig, lef) = (rig - 1, lef - 1)
		if not high(num, k) >= s >= low(k):
			print(-1)
			continue
		l = [0] * num
		lp = lef
		rp = lef - 1
		for i in range(num, 0, -1):
			if high(i, k) >= s and s - i >= low(k - 1) and k:
				l[lp] = i
				lp += 1
				s -= i
				k -= 1
			else:
				l[rp] = i
				rp -= 1
		if k:
			print(-1)
		else:
			print(*l)

def newcom():
	for _ in range(int(input())):
		(days, price) = map(int, input().split())
		dl = input().split()
		worth = input().split()
		worth.append(0)
		ans = float('inf')
		req = 0
		left = 0
		for i in range(days):
			a = int(dl[i])
			w = int(worth[i])
			ans = min(ans, req + max(0, price - left + a - 1) // a)
			ns = max(0, w - left + a - 1) // a
			req += ns + 1
			left += a * ns - w
		print(ans)

def perfectsq():
	for _ in range(int(input())):
		n = input()
		for i in input().split():
			sq = math.sqrt(int(i))
			if sq != int(sq):
				print('YES')
				break
		else:
			print('NO')

def and0big():
	for _ in range(int(input())):
		(l, k) = map(int, input().split())
		print(l ** k % mod)
import math

def mod1p():
	n = int(input())
	ans = dict()
	p = 1
	for i in range(1, n):
		if math.gcd(i, n) == 1:
			ans[str(i)] = True
			p = p * i % n
	if p == 1:
		print(len(ans))
		print(' '.join(ans.keys()))
	else:
		ans.pop(str(p))
		print(len(ans))
		print(' '.join(ans.keys()))

def shorttask():
	num = 10000100
	l = [-1] * (num + 2)
	s = [-1] * (num + 2)
	l[1] = 1
	for i in range(2, int(math.sqrt(num + 1)) + 2):
		if l[i] == -1:
			l[i] = i
			for x in range(i * i, num + 1, i):
				if l[x] == -1:
					l[x] = i
	s[1] = 1
	for i in range(2, num + 1):
		if l[i] == -1:
			l[i] = i
			s[i] = i + 1
		else:
			i1 = i
			s[i] = 1
			while i1 % l[i] == 0:
				i1 //= l[i]
				s[i] = s[i] * l[i] + 1
			s[i] *= s[i1]
	ans = [-1] * (num + 1)
	for i in range(num, 0, -1):
		if s[i] < num:
			ans[s[i]] = i
	for _ in range(int(input())):
		print(ans[int(input())])

def review():
	for _ in range(int(input())):
		n = int(input())
		ans = 0
		for i in input().split():
			i = int(i)
			if i == 1 or i == 3:
				ans += 1
		print(ans)

def GCDleng():
	po10 = [0] * 11
	po10[1] = 1
	for i in range(2, 11):
		po10[i] = po10[i - 1] * 10
	for _ in range(int(input())):
		(n, n1, res) = map(int, input().split())
		print(po10[n], po10[n1] + po10[res])

def anothercarddeck():
	(n, q) = map(int, input().split())
	l = input().split()
	d = {l[i]: i for i in range(n - 1, -1, -1)}
	ans = []
	for i in input().split():
		now = d[i]
		ans.append(now + 1)
		for key in d:
			if d[key] < now:
				d[key] += 1
		d[i] = 0
	print(*ans)

def mincoststring():
	(n, letters) = map(int, input().split())
	l = [chr(i + 97) for i in range(letters)]
	ans = []
	real = letters - 1
	if not n:
		print(*ans, sep='')
		return
	if n == 1:
		print(*ans, sep='', end='')
		print(l[1 % (real + 1)])
		return
	while n:
		for i in range(len(l)):
			for i1 in range(i, len(l)):
				if i1 != real:
					ans.append(l[i1])
					ans.append(l[i])
					n -= 2
				else:
					ans.append(l[i1])
					n -= 1
				if not n:
					print(*ans, sep='')
					return
				if n == 1:
					print(*ans, sep='', end='')
					print(l[(i1 + 1) % (real + 1)])
					return
	print(*ans)

def mincost2():
	(n, letters) = map(int, input().split())
	l = [chr(i + 97) for i in range(letters)]
	comb = []
	if letters == 1 or n == 1:
		print('a' * n)
		return
	for i in range(letters):
		for i1 in range(i, letters):
			comb.append(l[i1] + l[i])
	lc = len(comb)
	while True:
		for i in range(lc):
			if ord(comb[i][0]) - 97 == letters - 1:
				n -= 1
				print(comb[i][0], end='')
			else:
				n -= 2
				print(comb[i], end='')
			if n == 1:
				pos = ord(comb[i][0]) - 97 + 1
				print(l[pos % letters])
				return
			if not n:
				return

def Tittat():
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		l = list(map(int, input().split()))
		for i in range(n):
			if not k:
				break
			while k and l[i]:
				l[i] -= 1
				l[-1] += 1
				k -= 1
		print(*l)

def xorq2():
	for _ in range(int(input())):
		n = int(input())
		s = 0
		num = -1
		nc = 0
		c = 0
		for i in input().split():
			i = int(i)
			s ^= i
			c += 1
			if num == -1 and s == i:
				num = s
				s = 0
				nc += c
				c = 0
			if num != -1 and (s == num or not s):
				s = 0
				nc += c
				c = 0
		print(['NO', 'YES'][nc == n])

def xorq2re():
	n = int(input())
	s = input().split()
	xor = 0
	for i in range(n):
		s[i] = int(s[i])
		xor ^= s[i]
	if not xor:
		print('YES')
	else:
		new = 0
		ans = 0
		for i in s:
			new ^= i
			if new == xor:
				new = 0
				ans += 1
		print(['NO', 'YES'][ans > 1])
import sys
sys.setrecursionlimit(2300)

def q3partition():

	def partition():
		if tol % 2:
			return 0
		up = tol
		rec = [[False] * (up + 2) for _ in range(n + 1)]
		rec[0][0] = True
		for i in range(1, n + 1):
			v = l[i - 1]
			for j in range(up + 1):
				if rec[i - 1][j]:
					if v + j <= up:
						rec[i][j + v] = True
					rec[i][j] = True
		return rec[n][tol // 2]

	def ints(x):
		nonlocal tol
		nonlocal gcf
		x = int(x)
		tol += x
		gcf = math.gcd(gcf, x) if gcf != float('inf') else x
		return x
	n = int(input())
	tol = 0
	gcf = float('inf')
	l = list(map(ints, input().split()))
	if partition():
		pos = 1
		for i in l:
			if i // gcf % 2:
				print(1)
				print(pos)
				return
			pos += 1
	else:
		print(0)

def permu(n, r):
	return math.factorial(n) // math.factorial(n - r)

def comb(n, r):
	return math.factorial(n) // math.factorial(r) * math.factorial(n - r)

def calc():
	n = int(input())
	ans = permu(n, n)
	for i in range(1, n + 1):
		ans -= comb(n, i)
	print(ans)

def order():
	for _ in range(int(input())):
		n = int(input())
		odd = []
		even = []
		for i in input().split():
			i = int(i)
			if i % 2:
				odd.append(i)
			else:
				even.append(i)
		print(*odd + even)

def TMTdoc():
	n = int(input())
	l = input().rstrip()
	tts = 0
	tms = 0
	for i in l:
		if i == 'T':
			tts += 1
		else:
			tms += 1
	if tms * 2 == tts:
		nowts = 0
		nowms = 0
		for i in l:
			if i == 'T':
				nowts += 1
			else:
				nowms += 1
				if nowts >= nowms and tms - nowms + 1 <= tts - nowts:
					continue
				return 'NO'
	else:
		return 'NO'
	return 'YES'

def relayrace():

	def solve(n):
		if n:
			s = -1
		else:
			s = 1
		nowmax = -float('inf')
		nowmin = -nowmax
		ans = 0
		for (i, v) in sorted(l, key=lambda x: (x[1], s * int(x[0])), reverse=True):
			i = int(i)
			if i > nowmax:
				nowmax = i
			if i < nowmin:
				nowmin = i
			ans += v * (nowmax - nowmin)
		return ans
	n = int(input())
	l = -1
	ans = 0
	for i in sorted(input().split(), key=lambda x: int(x)):
		if l == -1:
			l = int(i)
		else:
			ans += int(i) - l
	return ans

def relayraces():
	n = int(input())
	l = sorted(map(int, input().split()))
	minv = float('INF')
	minpos = 0
	for i in range(len(l)):
		if i > 0 and 0 <= l[i] - l[i - 1] <= minv:
			minv = l[i] - l[i - 1]
			minpos = i
		if i < n - 1 and l[i + 1] - l[i] <= minv:
			minv = l[i + 1] - l[i]
			minpos = i
	lpos = minpos - 1
	rpos = minpos + 1
	ans = 0
	while lpos >= 0 and rpos < n:
		diffl = -(l[lpos] - l[minpos])
		diffr = l[rpos] - l[minpos]
		if diffl < diffr:
			minpos = lpos
			lpos -= 1
			ans += diffl
		else:
			minpos = rpos
			rpos += 1
			ans += diffr
	if lpos < 0:
		m = l[0]
		for i in range(rpos, n):
			ans += l[i] - m
	else:
		h = l[-1]
		for i in range(minpos, -1, -1):
			ans += h - l[i]
	return ans

def relayracess():

	def recur(l, r):
		if l == r:
			return 0
		if d[l, r] != -1:
			return d[l, r]
		ans = nums[r] - nums[l] + min(recur(l + 1, r), recur(l, r - 1))
		d[l, r] = ans
		return ans
	d = collections.defaultdict(lambda : -1)
	n = int(input())
	nums = sorted(map(int, input().split()))
	return recur(0, n - 1)

def relayracesss():
	n = int(input())
	l = sorted(map(int, input().split()))
	dp = [[0] * n for _ in range(n)]
	for i in range(n - 2, -1, -1):
		for i1 in range(i + 1, n):
			dp[i][i1] = l[i1] - l[i] + min(dp[i + 1][i1], dp[i][i1 - 1])
	return dp[0][n - 1]

def relayracessss():
	n = int(input())
	l = sorted(map(int, input().split()))
	dp = [0] * n
	for le in range(n - 2, -1, -1):
		for ri in range(le + 1, n):
			dp[ri] = l[ri] - l[le] + min(dp[ri], dp[ri - 1])
	return dp[-1]

def binli():
	n = int(input())
	n2 = n * 2
	s = input().rstrip()
	s1 = input().rstrip()
	s2 = input().rstrip()
	posl = [0, 0, 0]
	ans = ''
	while max(posl) < n2:
		l = [[], []]
		l[int(s[posl[0]])].append(0)
		l[int(s1[posl[1]])].append(1)
		l[int(s2[posl[2]])].append(2)
		if len(l[0]) >= 2:
			for i in l[0]:
				posl[i] += 1
			ans += '0'
		else:
			for i in l[1]:
				posl[i] += 1
			ans += '1'
	if posl[0] == n2:
		if posl[1] >= posl[2]:
			ans += s1[posl[1]:]
		else:
			ans += s2[posl[2]:]
	elif posl[1] == n2:
		if posl[0] >= posl[2]:
			ans += s[posl[0]:]
		else:
			ans += s2[posl[2]:]
	elif posl[0] >= posl[1]:
		ans += s[posl[0]:]
	else:
		ans += s1[posl[1]:]
	print(ans)

def almostsort():
	(n, k) = map(int, input().split())
	ul = 2 ** (n - 1)
	if k > ul:
		return [-1]
	permen = []
	bi = bin(k - 1)[2:]
	if bi == '0':
		return range(1, n + 1)
	pos = n - len(bi)
	ans = list(range(1, pos))
	for i in bi:
		permen.append(pos)
		if not int(i):
			ans += permen[::-1]
			permen = []
		pos += 1
	permen.append(n)
	ans += permen[::-1]
	return ans

def q1_2050():
	for i in range(int(input())):
		s = int(input())
		if s % 2050:
			print(-1)
		else:
			ab = 2050
			while ab <= s:
				ab *= 10
			ab //= 10
			c = 0
			while s and s != 1:
				c += s // ab
				s = s % ab
				while s != 1 and s and (s < ab):
					ab //= 10
			print(c)

def q2jog():
	(n, m) = map(int, input().split())
	sortbyval = []
	rowsv = [collections.defaultdict(int) for _ in range(n)]
	for row in range(n):
		for i in input().split():
			i = int(i)
			sortbyval.append([i, row])
			rowsv[row][i] += 1
	sortbyval.sort(key=lambda x: x[0])
	larl = []
	for i in range(0, n * m, m):
		larl.append(sortbyval[i:i + m])
	ans = [[0] * m for _ in range(n)]
	person = 0
	for i in larl:
		for (v, pos) in i:
			ans[pos][person] = v
			rowsv[pos][v] -= 1
			person += 1
			if person == m:
				break
		else:
			continue
		break
	for r in range(n):
		for c in range(m):
			if not ans[r][c]:
				for key in list(rowsv[r].keys()):
					if not rowsv[r][key]:
						rowsv[r].pop(key)
						continue
					rowsv[r][key] -= 1
					ans[r][c] = key
					break
	for i in ans:
		print(*i)

def q3fillomino(n, inp):

	def gorow():
		nonlocal nowp
		nonlocal col
		nonlocal totake
		t = 0
		if nowp and col < n and totake and (not l[col][nowp - 1]):
			for back in range(nowp, -1, -1):
				if l[col][back]:
					nowp += 1
					col += 1
					return t
				if not totake:
					return t
				l[col][back] = i
				totake -= 1
				nowp -= 1
				t = 1
			nowp += 1
			col += 1
		return t
	l = [[0] * i for i in range(1, n + 1)]
	p = 0
	for i in inp:
		totake = int(i)
		nowp = p
		col = p
		while col < n:
			if not totake:
				break
			for _ in range(n - p):
				if not gorow():
					break
			if not totake or col == n or nowp == n:
				break
			l[col][nowp] = i
			totake -= 1
			col += 1
		p += 1
	for i in l:
		print(*i)

def q3fillominoclear(n, inp):
	l = [[0] * i for i in range(1, n + 1)]
	p = 0
	for i in inp:
		take = int(i) - 1
		l[p][p] = i
		(x, y) = (p, p)
		while take:
			if y and (not l[x][y - 1]):
				y -= 1
			else:
				x += 1
			l[x][y] = i
			take -= 1
		p += 1
	for i in l:
		print(*i)

def q4explor():

	def gen(r, c):
		res = float('inf')
		if r:
			res = min(res, his[r - 1][c] + 2 * colstep[r - 1][c])
		if r < rows - 1:
			res = min(res, his[r + 1][c] + 2 * colstep[r][c])
		if c:
			res = min(res, his[r][c - 1] + 2 * rowstep[r][c - 1])
		if c < cols - 1:
			res = min(res, his[r][c + 1] + 2 * rowstep[r][c])
		return res
	(rows, cols, k) = map(int, input().split())
	if k % 2:
		for i in range(rows):
			print(*[-1] * cols)
		return
	rowstep = [list(map(int, input().split())) for _ in range(rows)]
	colstep = [list(map(int, input().split())) for _ in range(rows - 1)]
	his = [[0] * cols for _ in range(rows)]
	for _ in range(k // 2):
		temp = [[gen(r, c) for c in range(cols)] for r in range(rows)]
		his = temp
	for i in his:
		print(*i)

def cvacations():

	def de(v):
		nonlocal last
		if v == 2:
			last = 2
		elif v == 1:
			last = 1
	n = int(input())
	ans = 0
	last = 0
	l = input().split()
	for i1 in range(n):
		i = int(l[i1])
		if not i:
			last = 0
			ans += 1
			continue
		if i == 1:
			if last != 2:
				last = 2
				continue
			ans += 1
			last = 0
		elif i == 2:
			if last != 1:
				last = 1
				continue
			ans += 1
			last = 0
		elif not last:
			if i1 < n - 1:
				de(int(l[i1 + 1]))
				if int(l[i1 + 1]) == 3:
					for pos in range(i1 + 2, n):
						if l[pos] != 3:
							r = l[pos]
							break
					else:
						last = 1
						continue
					de(r)
			else:
				break
		elif last == 1:
			last = 2
		elif last == 2:
			last = 1
	return ans

def brackets():
	s = input().rstrip()
	(lpos, rpos) = (0, len(s) - 1)
	ans = []
	while lpos + 1 <= rpos:
		if s[lpos] == '(':
			if s[rpos] == ')':
				ans.append(lpos + 1)
				ans.append(rpos + 1)
				lpos += 1
				rpos -= 1
			else:
				rpos -= 1
		else:
			lpos += 1
	if ans:
		print(1)
		print(len(ans))
		print(*sorted(ans))
	else:
		print(0)

def In():
	return map(int, input().split())

def complibook():
	(n, q) = In()
	nums = list(In())
	for _ in range(q):
		(l, r, x) = In()
		num = nums[x - 1]
		les = 0
		for i in range(l - 1, r):
			if nums[i] < num:
				les += 1
		print(['No', 'Yes'][les + l - 1 == x - 1])
complibook()


(n, k) = map(int, input().split())
p = list(map(int, input().split()))

def solve():
	for i in range(k):
		(l, r, x) = map(int, input().split())
		(nrLarger, nrSmaller) = (r - x, x - l)
		(cL, cS) = (0, 0)
		if r == l:
			print('Yes')
		else:
			for j in range(l - 1, r):
				if p[j] < p[x - 1]:
					cS += 1
				if cS > nrSmaller:
					break
			print('Yes' if cS == nrSmaller else 'No')
solve()


def main():
	R = lambda : map(int, input().split())
	(n, m) = R()
	p = [0] + list(R())
	for _ in range(m):
		(l, r, x) = R()
		v = p[x]
		c = sum(map(lambda x: x < v, p[l:r + 1]))
		print('Yes' if c == x - l else 'No')
main()


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
for i in range(m):
	(l, r, x) = map(int, input().split())
	b = a[l - 1:r]
	(z, t) = (0, 0)
	for j in range(x - l):
		if b[j] > b[x - l]:
			z += 1
	for j in range(x - l + 1, r - l + 1):
		if b[j] < b[x - l]:
			t += 1
	if t == z:
		print('Yes')
	else:
		print('No')


(n, m) = [int(x) for x in input().split(' ')]
a = [int(x) for x in input().split(' ')]
for i in range(m):
	(l, r, x) = [int(x) for x in input().split(' ')]
	smaller = 0
	for i in range(l - 1, r):
		if a[i] < a[x - 1]:
			smaller += 1
	if smaller == x - l:
		print('Yes')
	else:
		print('No')


def countSort(vet):
	upper = max(vet)
	count = [0] * (upper + 1)
	output = [0] * len(vet)
	for v in vet:
		count[v] += 1
	for i in range(1, upper + 1):
		count[i] += count[i - 1]
	for i in range(len(vet)):
		output[count[vet[i]] - 1] = vet[i]
		count[vet[i]] -= 1
	return output
(n, m) = list(map(int, input().strip().split()))
perm = list(map(int, input().strip().split()))
for i in range(m):
	(l, r, x) = list(map(int, input().strip().split()))
	if l == r == x:
		print('Yes')
		continue
	print('Yes' if countSort(perm[l - 1:r])[x - l] == perm[x - 1] else 'No')