Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger this value is, the better the friendship is. No two friends have the same value ti.

Spring is starting and the Winter sleep is over for bears. Limak has just woken up and logged in. All his friends still sleep and thus none of them is online. Some (maybe all) of them will appear online in the next hours, one at a time.

The system displays friends who are online. On the screen there is space to display at most k friends. If there are more than k friends online then the system displays only k best of them — those with biggest ti.

Your task is to handle queries of two types:

  * "1 id" — Friend id becomes online. It's guaranteed that he wasn't online before. 
  * "2 id" — Check whether friend id is displayed by the system. Print "YES" or "NO" in a separate line. 



Are you able to help Limak and answer all queries of the second type?

Input

The first line contains three integers n, k and q (1 ≤ n, q ≤ 150 000, 1 ≤ k ≤ min(6, n)) — the number of friends, the maximum number of displayed online friends and the number of queries, respectively.

The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 109) where ti describes how good is Limak's relation with the i-th friend.

The i-th of the following q lines contains two integers typei and idi (1 ≤ typei ≤ 2, 1 ≤ idi ≤ n) — the i-th query. If typei = 1 then a friend idi becomes online. If typei = 2 then you should check whether a friend idi is displayed.

It's guaranteed that no two queries of the first type will have the same idi becuase one friend can't become online twice. Also, it's guaranteed that at least one query will be of the second type (typei = 2) so the output won't be empty.

Output

For each query of the second type print one line with the answer — "YES" (without quotes) if the given friend is displayed and "NO" (without quotes) otherwise.

Examples

Input

4 2 8
300 950 500 200
1 3
2 4
2 3
1 1
1 2
2 1
2 2
2 3


Output

NO
YES
NO
YES
YES


Input

6 3 9
50 20 51 17 99 24
1 3
1 4
1 5
1 2
2 4
2 2
1 1
2 4
2 3


Output

NO
YES
NO
YES

Note

In the first sample, Limak has 4 friends who all sleep initially. At first, the system displays nobody because nobody is online. There are the following 8 queries:

  1. "1 3" — Friend 3 becomes online. 
  2. "2 4" — We should check if friend 4 is displayed. He isn't even online and thus we print "NO". 
  3. "2 3" — We should check if friend 3 is displayed. Right now he is the only friend online and the system displays him. We should print "YES". 
  4. "1 1" — Friend 1 becomes online. The system now displays both friend 1 and friend 3. 
  5. "1 2" — Friend 2 becomes online. There are 3 friends online now but we were given k = 2 so only two friends can be displayed. Limak has worse relation with friend 1 than with other two online friends (t1 < t2, t3) so friend 1 won't be displayed 
  6. "2 1" — Print "NO". 
  7. "2 2" — Print "YES". 
  8. "2 3" — Print "YES".

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
str1 = input().split()
n = int(str1[0])
k = int(str1[1])
q = int(str1[2])
friends = list(map(lambda x: int(x), input().split()))
online = set()
for i in range(q):
	str1 = input().split()
	if str1[0] == '2':
		if int(str1[1]) in online:
			print('YES')
		else:
			print('NO')
	else:
		online.add(int(str1[1]))
		if len(online) > k:
			minelem = int(str1[1])
			for on in online:
				if friends[on - 1] < friends[minelem - 1]:
					minelem = on
			online.remove(minelem)


import sys
import math
import itertools as it
import operator as op
import heapq
(n, k, q) = map(int, sys.stdin.readline().split())
T = list(map(int, sys.stdin.readline().split()))
online = []
for i in range(q):
	(t, fid) = map(int, sys.stdin.readline().split())
	fid -= 1
	if t == 1:
		heapq.heappush(online, (-T[fid], fid))
		online = heapq.nsmallest(k, online)
	elif (-T[fid], fid) in online:
		print('YES')
	else:
		print('NO')


from collections import deque

class heap:

	def __init__(self, k):
		self.heap = deque()
		self.len = 0
		self.k = k
		self.reversedheap = deque()

	def add(self, x):
		self.heap.appendleft(x)
		self.reversedheap.appendleft(x)
		self.len += 1
		self.standize()
		if self.len > self.k:
			self.pop()
			self.len = self.k

	def pop(self):
		self.heap.remove(self.reversedheap.popleft())

	def standize(self):
		t = 0
		k = self.len
		while 2 * t + 1 <= k - 1:
			if 2 * t + 2 > k - 1:
				m = 2 * t + 1
			elif self.reversedheap[2 * t + 2] > self.reversedheap[2 * t + 1]:
				m = 2 * t + 1
			else:
				m = 2 * t + 2
			if self.reversedheap[t] > self.reversedheap[m]:
				(self.reversedheap[m], self.reversedheap[t]) = (self.reversedheap[t], self.reversedheap[m])
				t = m
			else:
				break
		t = 0
		while 2 * t + 1 <= k - 1:
			if self.heap[t] < self.heap[2 * t + 1]:
				(self.heap[2 * t + 1], self.heap[t]) = (self.heap[t], self.heap[2 * t + 1])
				t = 2 * t + 1
			elif 2 * t + 2 <= k - 1 and self.heap[t] < self.heap[2 * t + 2]:
				(self.heap[2 * t + 2], self.heap[t]) = (self.heap[t], self.heap[2 * t + 2])
				t = 2 * t + 2
			else:
				break

	def show(self, x):
		if x in set(self.heap):
			return 'YES'
		else:
			return 'NO'
(n, k, q) = map(int, input().split())
t = list(map(int, input().split()))
online = heap(k)
ans = []
for i in range(q):
	(typei, idi) = map(int, input().split())
	if typei == 1:
		online.add(t[idi - 1])
	else:
		ans.append(online.show(t[idi - 1]))
print('\n'.join(ans))


from heapq import *
(n, f, q) = [int(s) for s in input().split()]
loves = [int(s) for s in input().split()]
k = []
onlines = set()
for i in range(q):
	(ind, num) = [int(s) for s in input().split()]
	if ind == 1:
		onlines.add(num - 1)
		if len(k) < f:
			heappush(k, loves[num - 1])
		else:
			heappushpop(k, loves[num - 1])
	elif num - 1 in onlines and k[0] <= loves[num - 1]:
		print('YES')
	else:
		print('NO')


II = lambda : map(int, input().split())
(n, k, q) = II()
a = list(II())
display = set()
for _ in range(q):
	(t, d) = II()
	val = a[d - 1]
	if t == 1:
		if len(display) < k:
			display.add(val)
		else:
			m = min(display)
			if val > m:
				display.add(val)
				display.remove(m)
	else:
		print(('NO', 'YES')[val in display])


I = lambda : map(int, input().split())
(n, k, q) = I()
t = [0] + list(I())
a = []
s = ''
for _ in range(q):
	(p, i) = I()
	if p == 1:
		a.append(i)
	else:
		a = sorted(a, key=lambda x: t[x], reverse=1)[:k]
		s += ['NO\n', 'YES\n'][i in a]
print(s)


Input = lambda : map(int, input().split())

def bin(x):
	if x in z and z[x] == 1 or len(b) == 0:
		print('NO')
		return
	if x in b:
		print('YES')
		return
	else:
		print('NO')
		return
b = []
(n, k, q) = map(int, input().split())
z = dict()
a = [int(x) for x in input().split()]
for i in range(q):
	(x, y) = map(int, input().split())
	if x == 1:
		if len(b) != 0 and b[min(k - 1, len(b) - 1)] > a[y - 1] and (len(b) >= k):
			z[a[y - 1]] = 1
		elif len(b) != k:
			b.append(a[y - 1])
			for j in range(min(k, len(b)) - 1, 0, -1):
				if b[j] > b[j - 1]:
					(b[j], b[j - 1]) = (b[j - 1], b[j])
		else:
			for j in range(min(k, len(b)) - 1, -1, -1):
				if b[j] < a[y - 1]:
					b[j] = a[y - 1]
					break
			for j in range(min(k, len(b)) - 1, 0, -1):
				if b[j] > b[j - 1]:
					(b[j], b[j - 1]) = (b[j - 1], b[j])
	else:
		bin(a[y - 1])


nkq = list(map(int, input().split()))
friends = list(map(int, input().split()))
onlineFriends = {}

def checkTop(aDict, value):
	return value in aDict
for i in range(nkq[2]):
	query = list(map(int, input().split()))
	if query[0] == 1:
		onlineFriends[query[1]] = friends[query[1] - 1]
		if nkq[1] >= len(onlineFriends.items()):
			pass
		else:
			newDict = {}
			aList = onlineFriends.values()
			aList = sorted(aList)[len(aList) - nkq[1]:]
			for i in onlineFriends.keys():
				if onlineFriends[i] in aList:
					newDict[i] = onlineFriends[i]
			onlineFriends = newDict
	else:
		statement = checkTop(onlineFriends, query[1])
		if statement:
			print('YES')
		else:
			print('NO')


__author__ = 'Utena'
from collections import deque
(n, k, q) = map(int, input().split())
screen = []
ans = []
relation = [0] + list(map(int, input().split()))
total = 0
for i0 in range(q):
	(type, id) = map(int, input().split())
	if type == 1:
		screen.append(id)
		total += 1
		for i in range(1, total):
			if relation[screen[-i]] > relation[screen[-i - 1]]:
				a = screen[-i - 1]
				screen[-i - 1] = screen[-i]
				screen[-i] = a
		if total > k:
			screen.pop()
			total -= 1
	if type == 2:
		if id in screen:
			ans.append('YES')
		else:
			ans.append('NO')
print('\n'.join(ans))


import os
import sys
import math
import heapq
from decimal import *
from io import BytesIO, IOBase
from collections import defaultdict, deque

def main():
	(n, k, q) = rm()
	a = rl()
	b = []
	for i in range(q):
		(c, d) = rm()
		if c == 1:
			d -= 1
			b.append([a[d], d])
			b.sort(reverse=True)
			b = b[:k]
		elif c == 2:
			d -= 1
			ans = False
			for i in b:
				if i[1] == d:
					ans = True
					break
			if ans:
				print('YES')
			else:
				print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		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 = os.read(self._fd, max(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 = os.read(self._fd, max(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:
			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')

def r():
	return int(input())

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

def rl():
	return list(map(int, input().split()))
main()


(n, k, q) = map(int, input().split())
t = tuple((int(friendship) for friendship in input().split()))
window = set()
for i in range(q):
	(query, friend_id) = map(int, input().split())
	friend_id -= 1
	if query == 1:
		if len(window) < k:
			window.add(friend_id)
		else:
			least_friend = min(window, key=lambda friend: t[friend])
			if t[least_friend] < t[friend_id]:
				window.discard(least_friend)
				window.add(friend_id)
	else:
		print('YES' if friend_id in window else 'NO')


i = input().split()
(n, k, q) = (int(i[0]), int(i[1]), int(i[2]))
l = list(map(int, input().split()))
d = [0] * k
for i in range(q):
	j = input().split()
	x = l[int(j[1]) - 1]
	if j[0] == '1':
		d.append(x)
		for h in range(1, k + 1):
			if d[-h] > d[-h - 1]:
				(d[-h], d[-h - 1]) = (d[-h - 1], d[-h])
			else:
				break
		del d[-1]
	elif x in d:
		print('YES')
	else:
		print('NO')


(n, k, q) = tuple(map(int, input().split()))
t = [0]
t.extend([i for i in tuple(map(int, input().split()))])
ol = [None for i in range(k + 1)]
a = 0
li = []
for i in range(q):
	(ty, id) = tuple(map(int, input().split()))
	if ty == 2:
		if id in ol:
			li.append('YES')
		else:
			li.append('NO')
	elif ty == 1:
		if a < k:
			a += 1
			ol[a] = id
		else:
			smallest = t[id]
			to_be_replaced = None
			for j in range(k + 1)[1:]:
				if t[ol[j]] < smallest:
					smallest = t[ol[j]]
					to_be_replaced = j
				else:
					pass
			if not to_be_replaced is None:
				ol[to_be_replaced] = id
print('\n'.join(li))


(n, k, q) = [int(a) for a in input().strip().split()]
t = [int(a) for a in input().strip().split()]
s = []

def ssort():
	for i in range(len(s) - 1):
		if s[i] > s[i + 1]:
			(s[i], s[i + 1]) = (s[i + 1], s[i])
	if len(s) > k:
		s.pop(0)
for i in range(q):
	(type, id) = [int(a) for a in input().strip().split()]
	if type == 1:
		if len(s) == 0:
			s = [t[id - 1]]
		elif len(s) < k or t[id - 1] > s[0]:
			s = [t[id - 1]] + s
			ssort()
	elif t[id - 1] in s:
		print('YES')
	else:
		print('NO')


from sys import stdin as Si
from operator import itemgetter as ig
(n, k, q) = map(int, Si.readline().split())
T = tuple(map(int, Si.readline().split()))
stack = {}
for i in range(q):
	(a, b) = map(int, Si.readline().split())
	if a == 1:
		if len(stack) < k:
			stack[b] = T[b - 1]
		else:
			stack[b] = T[b - 1]
			while len(stack) > k:
				(x, y) = min(stack.items(), key=ig(1))
				del stack[x]
	elif a == 2:
		if b in stack:
			print('YES')
		else:
			print('NO')


import heapq as pq
h = []
(n, k, q) = map(int, input().split())
ts = list(map(int, input().split()))
for _ in range(q):
	(t, i) = map(int, input().split())
	if t == 1:
		pq.heappush(h, (ts[i - 1], i))
		if len(h) > k:
			pq.heappop(h)
	elif i in map(lambda p: p[1], h):
		print('YES')
	else:
		print('NO')


def main():
	(n, k, q) = (int(x) for x in input().split())
	bears = [int(x) for x in input().split()]
	queries = [None] * q
	for i in range(q):
		(typei, idi) = (int(x) for x in input().split())
		queries[i] = (typei, idi)
	solver(k, bears, queries)

def solver(k, bears, queries):
	kBest = set()
	for (typei, idi) in queries:
		if typei == 1:
			handle1(k, kBest, bears, idi)
		elif typei == 2:
			print(handle2(kBest, bears, idi))

def handle1(k, kBest, bears, idi):
	friendship = bears[idi - 1]
	if len(kBest) < k:
		kBest.add(friendship)
	else:
		minimum = min(kBest)
		if minimum < friendship:
			kBest.remove(minimum)
			kBest.add(friendship)

def handle2(kBest, bears, idi):
	friendship = bears[idi - 1]
	if friendship in kBest:
		return 'YES'
	else:
		return 'NO'
main()


ins = input().split(' ')
(num, wid, que) = (int(ins[0]), int(ins[1]), int(ins[2]))
t = [-1]
ins = input().split(' ')
for i in range(0, num):
	t.append(int(ins[i]))
dis = []
for i in range(0, que):
	ins = input().split(' ')
	(qt, fid) = (int(ins[0]), int(ins[1]))
	if qt == 1:
		imi = t[fid]
		for j in range(0, len(dis)):
			if dis[j][1] < imi:
				dis.insert(j, [fid, t[fid]])
				break
		else:
			if len(dis) < wid:
				dis.append([fid, t[fid]])
		if len(dis) > wid:
			dis.pop(wid)
	else:
		for j in range(0, len(dis)):
			if dis[j][0] == fid:
				print('YES')
				break
		else:
			print('NO')


limak = list(map(int, input().split()))
friends = limak[0]
online = limak[1]
queries = limak[2]
relation = list(map(int, input().split()))
list_onl = dict()
largo = 0
for i in range(queries):
	query = list(map(int, input().split()))
	if query[0] == 1:
		list_onl[relation[query[1] - 1]] = query[1]
		largo += 1
		if largo > online:
			del list_onl[min(list_onl.keys())]
			largo -= 1
	elif query[0] == 2:
		if query[1] in list_onl.values():
			print('YES')
		else:
			print('NO')


import sys

def siftup(ind):
	global tree
	while ind != 1 and frendly[tree[ind]] < frendly[tree[ind // 2]]:
		(tree[ind], tree[ind // 2]) = (tree[ind // 2], tree[ind])
		ind //= 2

def siftdown(ind):
	global tree
	while ind * 2 + 1 <= len(tree) - 1 and (frendly[tree[ind]] > frendly[tree[ind * 2]] or frendly[tree[ind]] > frendly[tree[ind * 2 + 1]]):
		if frendly[tree[ind * 2]] > frendly[tree[ind * 2 + 1]]:
			(tree[ind], tree[ind * 2 + 1]) = (tree[ind * 2 + 1], tree[ind])
			ind = ind * 2 + 1
		else:
			(tree[ind], tree[ind * 2]) = (tree[ind * 2], tree[ind])
			ind *= 2
	if ind * 2 <= len(tree) - 1 and frendly[tree[ind]] > frendly[tree[ind * 2]]:
		(tree[ind], tree[ind * 2]) = (tree[ind * 2], tree[ind])
		ind *= 2
(n, k, q) = map(int, sys.stdin.readline().split())
frendly = [0] + list(map(int, sys.stdin.readline().split()))
bearsout = set([i for i in range(1, n + 1)])
tree = [0]
for i in range(q):
	(lab, b) = map(int, sys.stdin.readline().split())
	if lab == 1:
		if len(tree) > k:
			if frendly[b] > frendly[tree[1]]:
				bearsout.discard(b)
				bearsout.add(tree[1])
				tree[1] = b
				siftdown(1)
		else:
			tree.append(b)
			bearsout.discard(b)
			siftup(len(tree) - 1)
	elif b in bearsout:
		sys.stdout.write('NO' + '\n')
	else:
		sys.stdout.write('YES' + '\n')


string = input()
(a, b, c) = map(int, string.split())
string = input()
values = list(map(int, string.split()))
(friends, results) = ([], [])
n = 0
for x in range(c):
	string = input()
	numbers = string.split()
	(p, q) = (int(numbers[0]), int(numbers[1]))
	if p == 1:
		friends.append(values[q - 1])
		for y in range(n, 0, -1):
			(s, t) = (friends[y], friends[y - 1])
			if s > t:
				(friends[y], friends[y - 1]) = (t, s)
			else:
				break
		if n == b:
			del friends[-1]
		else:
			n += 1
	elif values[q - 1] in friends:
		results.append('YES')
	else:
		results.append('NO')
for x in results:
	print(x)


(n, k, q) = map(int, input().split())
t = list(map(int, input().split()))
d = {}
for i in range(n):
	d[i + 1] = t[i]
sp = []
for i in range(q):
	(a, b) = map(int, input().split())
	if a == 1:
		if len(sp) == 0:
			sp.append(b)
		else:
			j = 0
			x = d[b]
			bb = True
			while d[sp[j]] > x:
				j += 1
				if j == len(sp):
					if len(sp) < k:
						sp.append(b)
					bb = False
					break
			if bb:
				s1 = sp[:j]
				s2 = sp[j:]
				sp = s1 + [b] + s2
				if len(sp) > k:
					sp.remove(sp[-1])
	elif b in sp:
		print('YES')
	else:
		print('NO')


(n, k, q) = map(int, input().split())
T = list(map(int, input().split()))
Q = [list(map(int, input().split())) for _ in range(q)]
C = []
B = []
for i in range(q):
	l = Q[i]
	if l[0] == 1:
		C = C + [T[l[1] - 1]]
		B = B + [l[1]]
		if len(C) > k:
			min = C[0]
			ours = 0
			for j in range(1, k + 1):
				if C[j] < min:
					min = C[j]
					ours = j
			del C[ours]
			del B[ours]
	elif l[1] in B:
		print('YES')
	else:
		print('NO')


(n, k, q) = map(int, input().split())
level = list(map(int, input().split()))
qt = []
qid = []
lfr = set()
for i in range(0, q):
	(qtemp, qidtemp) = map(int, input().split())
	if qtemp == 1:
		if len(lfr) < k:
			lfr.add(qidtemp)
		else:
			minn = qidtemp
			for el in lfr:
				if level[el - 1] < level[minn - 1]:
					minn = el
			if level[minn - 1] != level[qidtemp - 1]:
				lfr.remove(minn)
				lfr.add(qidtemp)
	if qtemp == 2:
		if qidtemp in lfr:
			print('YES')
		else:
			print('NO')


def solve():
	(n, k, q) = map(int, input().split())
	fr = [0] + list(map(int, input().split()))
	on = []
	ans = []
	for _ in range(q):
		(t, i) = map(int, input().split())
		if t == 1:
			if len(on) < k:
				on += [fr[i]]
			elif fr[i] > min(on):
				on += [fr[i]]
				on.remove(min(on))
		elif fr[i] in on:
			ans += ['YES']
		else:
			ans += ['NO']
	return '\n'.join(ans)
print(solve())


def main():
	from sys import stdin
	from heapq import heappush, heappushpop
	(n, k, q) = map(int, input().split())
	l = list(map(int, input().split()))
	(m, h, res) = ([False] * n, [], [])
	for (a, b) in map(str.split, stdin.read().splitlines()):
		id = int(b) - 1
		if a == '1':
			m[id] = True
			if k:
				k -= 1
				heappush(h, (l[id], id))
			else:
				(_, id) = heappushpop(h, (l[id], id))
				m[id] = False
		else:
			res.append(('NO', 'YES')[m[id]])
	print('\n'.join(res))
main()


(n, k, q) = map(int, input().split())
t = list(map(int, input().split()))
res = set()
data = []
for _ in range(q):
	(req_type, req_id) = map(int, input().split())
	if req_type == 1:
		req_t = t[req_id - 1]
		data.append((req_id, req_t))
		res.add(req_id)
		if len(res) > k:
			data = sorted(data, key=lambda x: x[1], reverse=True)
			last = data[-1]
			data = data[:-1]
			res.remove(last[0])
	if req_type == 2:
		if req_id in res:
			print('YES')
		else:
			print('NO')


(n, k, q) = map(int, input().split())
Ts = list(map(int, input().split()))
displayed = []
for x in range(q):
	(type, id) = map(int, input().split())
	ti = Ts[id - 1]
	if type == 1:
		displayed.append(ti)
		displayed.sort()
		displayed.reverse()
		if len(displayed) > k:
			displayed.pop()
	elif type == 2:
		if ti in displayed:
			print('YES')
		else:
			print('NO')


def line():
	return [int(c) for c in input().split()]
(n, k, q) = line()
t = line()
H = []
from heapq import *
N = 0
H = []
for _ in range(q):
	(taipe, i) = line()
	if taipe == 1:
		heappush(H, (t[i - 1], i))
		if N < k:
			N += 1
		else:
			heappop(H)
	elif taipe == 2:
		if (t[i - 1], i) in H:
			print('YES')
		else:
			print('NO')


a = input()
b = a.split()
n = int(b[0])
k = int(b[1])
q = int(b[2])
a = input()
dr = a.split()
for i in range(len(dr)):
	dr[i] = int(dr[i])
online = []
answers = []
for i in range(q):
	a = input()
	t = a.split()
	tt = int(t[0])
	tr = int(t[1]) - 1
	if tt == 1:
		online.append(dr[tr])
		if len(online) > k:
			online.remove(min(online))
	elif dr[tr] in online:
		answers.append('YES')
	else:
		answers.append('NO')
for i in answers:
	print(i)


(n, k, q) = map(int, input().split())
arr = list(map(int, input().split()))
dis = []
for i in range(q):
	(t, id) = map(int, input().split())
	if t == 1:
		if len(dis) == k:
			if arr[id - 1] >= dis[0][0]:
				dis[0] = (arr[id - 1], id)
		else:
			dis.append((arr[id - 1], id))
		dis.sort()
	else:
		var = [dis[i][1] for i in range(len(dis))]
		if id in var:
			print('YES')
		else:
			print('NO')


from queue import PriorityQueue
(n, k, q) = [int(i) for i in input().split()]
display = [0] * (n + 1)
order = PriorityQueue(k + 1)
friend = [int(i) for i in input().split()]
minfri = 0
ans = []
for i in range(q):
	(kind, idd) = [int(j) for j in input().split()]
	if kind == 1:
		if friend[idd - 1] <= minfri:
			continue
		else:
			order.put((friend[idd - 1], idd))
			display[idd] = 1
			if order.full():
				tem = order.get()
				(de, minfri) = (tem[1], tem[0])
				display[de] = 0
	if kind == 2:
		if display[idd] == 1:
			ans.append('YES')
		else:
			ans.append('NO')
print('\n'.join(ans))


(n, k, q) = map(int, input().split())
t = list(map(int, input().split()))
current_online = [0] * k
for i in range(q):
	(type_op, id_op) = map(int, input().split())
	if type_op == 1:
		if t[id_op - 1] > current_online[0]:
			current_online[0] = t[id_op - 1]
			current_online.sort()
	elif t[id_op - 1] in current_online:
		print('YES')
	else:
		print('NO')


from heapq import *
L = []
heapify(L)
d = {}
(n, k, m) = map(int, input().split())
l = list(map(int, input().split()))
k1 = 0
for i in range(m):
	(a, b) = map(int, input().split())
	if a == 2:
		if d.get(l[b - 1], 0) == 0:
			print('NO')
		elif k1 <= l[b - 1]:
			print('YES')
		else:
			print('NO')
	else:
		heappush(L, l[b - 1])
		d[l[b - 1]] = 1
		if len(L) > k:
			k1 = heappop(L)
			k1 = heappop(L)
			heappush(L, k1)


import sys

class node:

	def __init__(self, id):
		self._id = id
		self._children = []
		self._parent = []
queue = []
tail = 0
(n, k, q) = map(int, sys.stdin.readline().split())
a = n * [0]
s = input()
a = s.split()
for i in range(n):
	a[i] = int(a[i])
for i in range(q):
	(type, idd) = map(int, sys.stdin.readline().split())
	idd -= 1
	if type == 1:
		if len(queue) == 0:
			queue.append(node(idd))
		else:
			l = len(queue)
			queue.append(node(idd))
			for j in range(len(queue) - 1):
				if queue[j]._parent == []:
					h = queue[j]
					head = j
			while a[h._id] > a[idd] and h._children != []:
				h = h._children[0]
				for j in range(len(queue)):
					if queue[j] == h:
						head = j
			if a[h._id] < a[idd]:
				if h._parent == []:
					queue[head]._parent = [queue[l]]
					queue[l]._children = [queue[head]]
				else:
					queue[head]._parent[0]._children = [queue[l]]
					queue[l]._parent = [queue[head]._parent[0]]
					queue[head]._parent = [queue[l]]
					queue[l]._children = [queue[head]]
			else:
				for j in range(l):
					if queue[j]._children == []:
						tail = j
				queue[tail]._children.append(queue[l])
				queue[l]._parent.append(queue[tail])
			if len(queue) > k:
				for j in range(len(queue)):
					if queue[j]._children == []:
						tail = j
				queue[tail]._parent[0]._children = []
				queue.remove(queue[tail])
	if type == 2:
		boolean = 0
		for j in range(len(queue)):
			if queue[j]._id == idd:
				boolean = 1
				print('YES')
		if boolean == 0:
			print('NO')


(n, k, q) = input().split()
rank = input().split()
for i in range(len(rank)):
	rank[i] = int(rank[i])
li = []
names = []
for i in range(int(q)):
	query = input().split()
	if query[0] == '1':
		if len(li) < int(k):
			names.append(query[1])
			li.append(rank[int(query[1]) - 1])
		else:
			m = min(li)
			ind = li.index(m)
			if rank[int(query[1]) - 1] > m:
				del li[ind]
				del names[ind]
				names.append(query[1])
				li.append(rank[int(query[1]) - 1])
	if query[0] == '2':
		if query[1] in names:
			print('YES')
		else:
			print('NO')


import sys
(n, k, q) = list(map(int, input().split()))
t = list(map(int, input().split()))
i = 0
mark = [False for i in range(n + 1)]
h = set([])
i = 0
while i < q:
	a = sys.stdin.readline()
	b = list(map(int, a.split()))
	b[0] = int(b[0])
	b[1] = int(b[1])
	if b[0] == 1:
		mark[b[1]] = True
		c = (t[b[1] - 1], b[1])
		if len(h) < k:
			h.add(c)
		else:
			d = min(h)
			if c[0] > d[0]:
				h.remove(d)
				h.add(c)
	elif mark[b[1]] and (t[b[1] - 1], b[1]) in h:
		print('YES')
	else:
		print('NO')
	i = i + 1


def ke(i):
	return a[i - 1]
(n, k, q) = map(int, input().split())
a = list(map(int, input().split()))
p = []
for i in range(q):
	(b, id) = map(int, input().split())
	id -= 1
	if b == 1:
		p += [id + 1]
		p.sort(key=ke, reverse=True)
		if len(p) > k:
			p = p[:-1]
	elif id + 1 in p:
		print('YES')
	else:
		print('NO')


import heapq
(n, k, q) = [int(i) for i in input().split()]
t = [0] + [int(i) for i in input().split()]
l = []
for i in range(q):
	(a, b) = [int(i) for i in input().split()]
	if a == 1:
		if len(l) < k:
			heapq.heappush(l, t[b])
		else:
			heapq.heappushpop(l, t[b])
	elif t[b] in l:
		print('YES')
	else:
		print('NO')


(n, k, q) = map(int, input().split())
t = [int(i) for i in input().split()]
f = []
for i in range(q):
	(y, d) = map(int, input().split())
	if y == 1:
		f += [t[d - 1]]
		for i in range(len(f) - 1, 0, -1):
			if f[i] > f[i - 1]:
				(f[i], f[i - 1]) = (f[i - 1], f[i])
			else:
				break
		if len(f) > k:
			f = f[0:k]
	elif t[d - 1] in f:
		print('YES')
	else:
		print('NO')


(n, k, q) = [int(i) for i in input().split()]
t = input().split()
ID = {}
online = []
for i in range(len(t)):
	ID[i + 1] = t[i]
for i in range(q):
	a = list(map(int, input().split()))
	if a[0] == 1:
		online.append([a[1], int(ID[a[1]])])
		if len(online) > k:
			online.sort(key=lambda x: x[1])
			del online[0]
	if a[0] == 2:
		if [a[1], int(ID[a[1]])] in online:
			print('YES')
		else:
			print('NO')


(n, k, q) = tuple(map(int, input().split()))
t = tuple(map(int, input().split()))
online = []
full = False
for i in range(q):
	query = tuple(map(int, input().split()))
	if query[0] == 1:
		if not full:
			online.append(query[1])
			full = len(online) >= k
		else:
			min_id = 0
			for j in range(len(online)):
				if t[online[min_id] - 1] > t[online[j] - 1]:
					min_id = j
			if t[online[min_id] - 1] < t[query[1] - 1]:
				online[min_id] = query[1]
	elif query[0] == 2:
		if query[1] in online:
			print('YES')
		else:
			print('NO')


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

def del_minv():
	global listed
	minv = 0
	for _ in range(len(listed)):
		if friend_value[listed[_]] < friend_value[listed[minv]]:
			minv = _
	del listed[minv]
friend_value = list(map(int, input().split()))
friend_online = [False] * len(friend_value)
for _ in range(q):
	query = list(map(int, input().split()))
	query[1] -= 1
	if query[0] == 1:
		friend_online[query[1]] = True
		listed.append(query[1])
		if len(listed) > k:
			del_minv()
	else:
		print('YES') if query[1] in listed else print('NO')


(n, k, q) = map(int, input().split())
t = list(map(int, input().split()))
f = []
for i in range(q):
	(a, b) = map(int, input().split())
	if a == 1:
		if len(f) < k:
			f.append(t[b - 1])
		else:
			f.append(t[b - 1])
			f.sort()
			f = f[::-1][:k]
	elif t[b - 1] in f:
		print('YES')
	else:
		print('NO')


from heapq import *
L = [int(s) for s in input().split()]
(n, k, q) = (L[0], L[1], L[2])
T = [int(s) for s in input().split()]
onlinevalue = []
heapify(onlinevalue)
for i in range(q):
	S = [int(s) for s in input().split()]
	if S[0] == 2:
		if T[S[1] - 1] in onlinevalue:
			print('YES')
		else:
			print('NO')
	elif len(onlinevalue) < k:
		heappush(onlinevalue, T[S[1] - 1])
	elif T[S[1] - 1] > onlinevalue[0]:
		heappop(onlinevalue)
		heappush(onlinevalue, T[S[1] - 1])


N = list(map(int, input().split()))
N.insert(0, 0)
A = list(map(int, input().split()))
A.insert(0, 0)
O = [0 for i in range(N[2])]
for i in range(N[3]):
	Q = list(map(int, input().split()))
	if Q[0] == 1:
		for j in range(1, N[2] + 1):
			if A[O[-j]] > A[Q[1]]:
				break
			elif j == 1:
				O[-j] = Q[1]
			else:
				O[-j + 1] = O[-j]
				O[-j] = Q[1]
	elif Q[1] in O:
		print('YES')
	else:
		print('NO')


import sys
window = set()
(n, k, q) = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
for i in range(q):
	(a, b) = [int(x) for x in input().split()]
	if a == 1:
		if len(window) < k:
			window.add(arr[b - 1])
		else:
			window.add(arr[b - 1])
			m = min(window)
			window.remove(m)
	else:
		print('YES' if arr[b - 1] in window else 'NO')


(n, k, q) = map(int, input().split())
a = list(map(int, input().split()))
window = []
for i in range(q):
	(t, id) = map(int, input().split())
	if t == 1:
		window.append(a[id - 1])
	if len(window) > k:
		window = sorted(window)[1:]
	if t == 2:
		find = False
		for j in window:
			if j == a[id - 1]:
				find = True
				break
		if find:
			print('YES')
		else:
			print('NO')


import bisect
line = input().split()
n = int(line[0])
k = int(line[1])
q = int(line[2])
f = input().split()
friendship = {}
display = []
size = 0
for i in range(1, n + 1):
	friendship[i] = int(f[i - 1])
for i in range(q):
	line = input().split()
	query = int(line[0])
	id = int(line[1])
	if query == 1:
		bisect.insort(display, (friendship[id], id))
		size += 1
		if size > k:
			display = display[1:]
			size = k
	if query == 2:
		if (friendship[id], id) in display:
			print('YES')
		else:
			print('NO')


def p1():
	(n, k, q) = [int(i) for i in input().split()]
	l = [int(i) for i in input().split()]
	s = []
	for i in range(q):
		(a, b) = [int(i) for i in input().split()]
		if a == 1:
			s.append(l[b - 1])
			s.sort()
			if len(s) > k:
				s.remove(s[0])
		if a == 2:
			if l[b - 1] in s:
				print('YES')
			else:
				print('NO')
p1()


(n, k, q) = [int(i) for i in input().split()]
t = [int(i) for i in input().split()]
online = []
for i in range(q):
	query = [int(j) for j in input().split()]
	if query[0] == 2:
		if query[1] in online:
			print('YES')
		else:
			print('NO')
	else:
		for j in range(len(online)):
			if t[online[j] - 1] < t[query[1] - 1]:
				online.insert(j, query[1])
				break
			if j == len(online) - 1:
				online.append(query[1])
		if not len(online):
			online.append(query[1])
		if len(online) > k:
			online.pop()


(n, k, q) = map(int, input().split())
friends = list(map(int, input().split()))
main = [None] * k
for i in range(q):
	(t, p) = map(int, input().split())
	if t == 1:
		for j in range(k):
			if main[k - j - 1] == None:
				main[k - j - 1] = p - 1
				break
			elif friends[main[k - j - 1]] < friends[p - 1]:
				nn = p - 1
				for l in range(k - j):
					nnn = main[k - j - l - 1]
					main[k - j - l - 1] = nn
					nn = nnn
				break
	elif t == 2:
		if p - 1 in main:
			print('YES')
		else:
			print('NO')


[n, k, q] = [int(i) for i in input().split()]
t = [int(i) for i in input().split()]
scr = []
for i in range(q):
	[type, id] = [int(j) for j in input().split()]
	if type == 1:
		scr.append(t[id - 1])
		scr.sort(reverse=True)
		if len(scr) > k:
			scr.pop()
	elif t[id - 1] in scr:
		print('YES')
	else:
		print('NO')


from operator import itemgetter

class CodeforcesTask658BSolution:

	def __init__(self):
		self.result = ''
		self.n_k_q = []
		self.rels = []
		self.queries = []

	def read_input(self):
		self.n_k_q = [int(x) for x in input().split(' ')]
		self.rels = [int(x) for x in input().split(' ')]
		for x in range(self.n_k_q[2]):
			self.queries.append([int(y) for y in input().split(' ')])

	def process_task(self):
		online = []
		results = []
		shown = {}
		for query in self.queries:
			if query[0] == 1:
				shown[query[1]] = True
				online.append((query[1], self.rels[query[1] - 1]))
				online.sort(key=itemgetter(1), reverse=True)
				if len(online) > self.n_k_q[1]:
					out = online.pop(-1)
					shown[out[0]] = False
			elif query[1] in shown:
				if shown[query[1]]:
					results.append('YES')
				else:
					results.append('NO')
			else:
				results.append('NO')
		self.result = '\n'.join(results)

	def get_result(self):
		return self.result
Solution = CodeforcesTask658BSolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


n = input()
b = []
b = n.split()
n = int(b[0])
k = int(b[1])
q = int(b[2])
c = input()
level = c.split()
online = []
for i in range(q):
	c = input()
	z = c.split()
	if z[0] == '1':
		if len(online) < k:
			online.append(int(z[1]))
		else:
			min = int(level[int(z[1]) - 1])
			number = -1
			for j in range(k):
				if int(level[online[j] - 1]) < min:
					min = int(level[online[j] - 1])
					number = j
			if number > -1:
				online[number] = int(z[1])
	elif online.count(int(z[1])) > 0:
		print('YES')
	else:
		print('NO')


def Core(size, rate, data):
	online_rate = []
	count = 0
	for item in data:
		if item[0] == 1:
			if size > count:
				count += 1
				online_rate.append(rate[item[1]])
				online_rate.sort(key=lambda x: -x)
			elif online_rate[-1] < rate[item[1]]:
				online_rate[-1] = rate[item[1]]
				online_rate.sort(key=lambda x: -x)
		elif rate[item[1]] in online_rate and online_rate.index(rate[item[1]]) < size:
			print('YES')
		else:
			print('NO')
param1 = input().split(' ')
param2 = [0] + [int(i) for i in input().split(' ')]
param3 = [[int(j) for j in input().split(' ')] for i in range(int(param1[2]))]
Core(int(param1[1]), param2, param3)


from collections import deque
MAX = 0
MIN = 0
(n, k, q) = [int(i) for i in input().split()]
nn = {}
m = [int(i) for i in input().split()]
kk = []
for i in range(1, n + 1):
	nn[m[i - 1]] = 0

def app(i):
	global MAX, MIN
	v = m[i - 1]
	if len(kk) < k:
		kk.append(v)
		return True
	elif len(kk) == k:
		kk.sort()
		MAX = kk[k - 1]
		MIN = kk[0]
		if v < MIN:
			return False
		else:
			kk.append(v)
			c = kk.pop(0)
			nn[c] -= 1
			return True
for i in range(q):
	qq = [int(i) for i in input().split()]
	if qq[0] == 1:
		nn[m[qq[1] - 1]] = 1
		if app(qq[1]):
			nn[m[qq[1] - 1]] = 2
	if qq[0] == 2:
		if nn[m[qq[1] - 1]] == 2:
			print('YES')
		else:
			print('NO')


(n, k, q) = map(int, input().split())
t = list(map(int, input().split()))
from collections import deque
online = []
m = 10000000000
for i in range(q):
	(type, id) = map(int, input().split())
	id -= 1
	if type == 1:
		online.append(t[id])
		m = min(t[id], m)
		if len(online) == k + 1:
			online.remove(m)
			m = min(online)
	elif type == 2:
		print('YES' if t[id] in online else 'NO')


(n, k, q) = map(int, input().split())
friends = list(map(int, input().split()))
query = []
for i in range(q):
	r = input().split()
	query.append((int(r[0]), int(r[1])))
online = set()
for (t, i) in query:
	if t == 1:
		if k > 0:
			online.add((friends[i - 1], i))
			k -= 1
		else:
			m = min(online, key=lambda x: x[0])
			if m[0] < friends[i - 1]:
				online.remove(m)
				online.add((friends[i - 1], i))
	elif (friends[i - 1], i) in online:
		print('YES')
	else:
		print('NO')


(n, k, q) = map(int, input().split())
data = list(map(int, input().split()))
data1 = set()
for i in range(q):
	(typ, fr) = map(int, input().split())
	fr -= 1
	if typ == 2:
		if data[fr] in data1:
			print('YES')
		else:
			print('NO')
	elif len(list(data1)) < k:
		data1.add(data[fr])
	elif data[fr] >= min(list(data1)):
		data1.add(data[fr])
		data1.remove(min(list(data1)))


import heapq

def friends(n, k, q, T, Q):
	H = []
	D = set()
	for (t, i) in Q:
		if t == 1:
			if len(H) < k:
				D.add(i)
				heapq.heappush(H, (T[i - 1], i))
			else:
				D.add(i)
				(_, j) = heapq.heappushpop(H, (T[i - 1], i))
				D.remove(j)
		else:
			yield (i in D)

def main():
	(n, k, q) = readinti()
	T = readintl()
	Q = readinttl(q)
	print('\n'.join(('YES' if r else 'NO' for r in friends(n, k, q, T, Q))))
import sys

def readint():
	return int(input())

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

def readintt():
	return tuple(readinti())

def readintl():
	return list(readinti())

def readinttl(k):
	return [readintt() for _ in range(k)]

def readintll(k):
	return [readintl() for _ in range(k)]

def log(*args, **kwargs):
	print(*args, **kwargs, file=sys.stderr)
main()


(n, k, q) = map(int, input().split())
z = [0] + list(map(int, input().split()))
p = []
for i in range(q):
	(u, v) = map(int, input().split())
	if u == 1:
		p += [v]
		if len(p) > k:
			r = 10000000000000000000
			f = 0
			for j in range(len(p)):
				if z[p[j]] < r:
					r = z[p[j]]
					f = p[j]
			p.remove(f)
	elif v in p:
		print('YES')
	else:
		print('NO')


(n, k, q) = map(int, input().split())
display = [(0, 0)] * k
friends = list(map(int, input().split()))
for _ in range(q):
	(tp, fid) = map(int, input().split())
	pwr = friends[fid - 1]
	if tp == 1:
		for i in range(k):
			if display[i][0] < pwr:
				display.insert(i, (pwr, fid))
				of = display.pop()[1]
				friends[fid - 1] = 0
				if of:
					friends[of - 1] = 1
				break
	else:
		print('NO' if pwr else 'YES')


from heapq import *
(n, k, q) = map(int, input().split())
t = [0] + list(map(int, input().split()))
s = []
tak = set()
ans = []
for i in range(q):
	(m, nom) = map(int, input().split())
	if m == 1:
		heappush(s, (t[nom], nom))
		tak |= {nom}
	if len(s) > k:
		(tt, no) = heappop(s)
		tak -= {no}
	if m == 2:
		ans += [['NO', 'YES'][nom in tak]]
print('\n'.join(ans))


import sys
from heapq import *
fin = sys.stdin
h = []
for (i, line) in enumerate(fin):
	if i == 0:
		(n, k, q) = [int(x) for x in line.split()]
		continue
	if i == 1:
		friendshipLevels = [int(x) for x in line.split()]
		continue
	(t, f) = [int(x) for x in line.split()]
	f -= 1
	if t == 1:
		heappush(h, (friendshipLevels[f], f))
		if len(h) > k:
			heappop(h)
	if t == 2:
		print('YES' if (friendshipLevels[f], f) in h else 'NO')


(n, k, q) = map(int, input().split())
t = list(map(int, input().split()))
ls = []
acti = [-1 for i in range(n)]
while q > 0:
	q -= 1
	(a, b) = map(int, input().split())
	b -= 1
	if a == 1 and acti[b] == -1:
		acti[b] = 1
		ls.append([t[b], b])
		ls.sort(reverse=True)
		if len(ls) > k:
			ls = ls[0:k]
		continue
	if a == 2:
		for j in ls:
			if j[1] == b:
				print('YES')
				break
		else:
			print('NO')


(n, k, q) = [int(i) for i in input().split()]
alist = [int(i) for i in input().split()]
blist = []
for i in range(q):
	(a, b) = [int(j) for j in input().split()]
	if a == 1:
		if len(blist) < k:
			blist.append(alist[b - 1])
		elif alist[b - 1] > min(blist):
			blist.append(alist[b - 1])
			blist.remove(min(blist))
	elif a == 2:
		if alist[b - 1] in blist:
			print('YES')
		else:
			print('NO')


(n, k, q) = (int(z) for z in input().split())
s = [int(z) for z in input().split()]
t = []
ans = []
for i in range(q):
	r = input()
	if r[0] == '2':
		if s[int(r[2:]) - 1] in t:
			ans += ['YES']
		else:
			ans += ['NO']
	elif len(t) < k:
		t.append(s[int(r[2:]) - 1])
		t.sort()
		t.reverse()
	else:
		u = 0
		while u <= k - 1 and t[u] > s[int(r[2:]) - 1]:
			u += 1
		if u < k:
			for g in range(k - 1, u, -1):
				t[g] = t[g - 1]
			t[u] = s[int(r[2:]) - 1]
for h in ans:
	print(h)


import heapq
(n, k, q) = [int(i) for i in input().split()]
t = [int(i) for i in input().split()]
h = []
isnew = False
for i in range(q):
	(type, id) = [int(i) for i in input().split()]
	if type == 1:
		if k > len(h):
			heapq.heappush(h, t[id - 1])
		else:
			heapq.heappushpop(h, t[id - 1])
	elif t[id - 1] in h:
		print('YES')
	else:
		print('NO')


(n, k, q) = [int(x) for x in input().split()]
T = [int(x) for x in input().split()]
S = set()
for i in range(q):
	(t, _id) = [int(x) for x in input().split()]
	if t == 1:
		m = min(S, default=0)
		if len(S) == k:
			if m < T[_id - 1]:
				S.remove(m)
				S.add(T[_id - 1])
		else:
			S.add(T[_id - 1])
	else:
		print('YES' if T[_id - 1] in S else 'NO')


(n, k, q) = map(int, input().split())
l = [0] + list(map(int, input().split()))
o = []
ans = []
for i in range(q):
	(x, y) = map(int, input().split())
	if x == 1:
		if len(o) < k:
			o += [l[y]]
		elif l[y] > min(o):
			o += [l[y]]
			o.remove(min(o))
	elif l[y] in o:
		ans += ['YES']
	else:
		ans += ['NO']
print('\n'.join(ans))


import heapq
(n, k, q) = [int(i) for i in input().split()]
t = [[]] * n
a = [int(i) for i in input().split()]
for i in range(n):
	t[i] = [a[i], i]
heap = []
for i in range(q):
	(type, id) = [int(i) for i in input().split()]
	if type == 1:
		if len(heap) == k:
			heapq.heappushpop(heap, t[id - 1])
		else:
			heapq.heappush(heap, t[id - 1])
	if type == 2:
		if t[id - 1] in heap:
			print('YES')
		else:
			print('NO')


import time
(n, k, q) = (int(i) for i in input().split())
t = [int(i) for i in input().split()]
show = []
ans = []
start = time.time()
for i in range(q):
	(f, id) = [int(i) for i in input().split()]
	id -= 1
	if f == 1:
		if len(show) < k:
			show.append(t[id])
		else:
			b = min(show)
			if b < t[id]:
				del show[show.index(b)]
				show.append(t[id])
	elif t[id] in show:
		ans.append('YES')
	else:
		ans.append('NO')
for i in range(len(ans)):
	print(ans[i])
finish = time.time()


import heapq
(n, k, q) = [int(i) for i in input().split()]
k = min(k, n)
Relations = [None]
ind = [0] * (n + 1)
heap = []
l = 0
Rmax = 0
for i in input().split():
	Relations.append(-int(i))
for i in range(q):
	(Q, ID) = [int(j) for j in input().split()]
	if Q == 1:
		ind[ID] = 1
		if l < k:
			heap.append(Relations[ID])
			heap.sort()
			l += 1
			Rmax = heap[l - 1]
		elif Relations[ID] < Rmax:
			heap[k - 1] = Relations[ID]
			heap.sort()
			Rmax = heap[l - 1]
	if Q == 2:
		if not ind[ID]:
			print('NO')
			continue
		Ri = Relations[ID]
		N = min(k, l)
		if Rmax < Ri:
			print('NO')
		else:
			print('YES')


(n, k, q) = list(map(int, input().split(' ')))
fr_lvl = list(map(int, input().split(' ')))
lvl = {i + 1: fr_lvl[i] for i in range(len(fr_lvl))}
online = 0
top_six = []
out = []
for step in range(q):
	count = 0
	found = False
	query = input()
	if query[0] == '1':
		online += 1
		if online < k + 1:
			top_six.append(int(query[2:]))
			top_six = sorted(top_six, key=lambda x: lvl[x])
		if online >= k + 1:
			if lvl[top_six[0]] < lvl[int(query[2:])]:
				top_six[0] = int(query[2:])
				top_six = sorted(top_six, key=lambda x: lvl[x])
	if query[0] == '2':
		out.append(int(query[2:]) in top_six and 'YES' or 'NO')
for i in out:
	print(i)


(n, k, q) = map(int, input().split())
t = [0] + list(map(int, input().split()))
ts = list()
for i in range(q):
	(typ, idi) = map(int, input().split())
	if typ == 1:
		cnt = len(ts)
		tl = t[idi]
		if cnt < k:
			ts.append(tl)
		elif ts[0] < tl:
			del ts[0]
			ts.append(tl)
		ts.sort()
	elif typ == 2:
		if t[idi] in ts:
			print('YES')
		else:
			print('NO')


(n, k, q) = map(int, input().split())
value = [int(x) for x in input().split()]
id = {}
ans = []
for i in range(q):
	(a, b) = map(int, input().split())
	if a == 1:
		if len(id) < k:
			id[b] = value[b - 1]
		else:
			x = min(id.items(), key=lambda x: x[1])[0]
			if value[b - 1] > id[x]:
				del id[x]
				id[b] = value[b - 1]
			else:
				continue
	if a == 2:
		if b in id.keys():
			ans.append('YES')
		else:
			ans.append('NO')
for i in ans:
	print(i)


from sys import stdin, stdout
(n, k, q) = map(int, input().split())
z = [0] + list(map(int, stdin.readline().split()))
p = []
ans = ''
for i in range(q):
	(u, v) = map(int, stdin.readline().split())
	if u == 1:
		p += [v]
		if len(p) > k:
			r = 10000000000000000000
			f = 0
			for j in range(len(p)):
				if z[p[j]] < r:
					r = z[p[j]]
					f = p[j]
			p.remove(f)
	elif v in p:
		ans += 'YES' + ' '
	else:
		ans += 'NO' + ' '
stdout.write(ans)


(n, k, q) = [int(i) for i in input().split()]
t = [int(i) for i in input().split()]
display = []
for i in range(q):
	(ty, d) = [int(j) for j in input().split()]
	if ty == 1:
		relation = t[d - 1]
		for j in range(len(display)):
			if relation > t[display[j] - 1]:
				display.insert(j, d)
				break
		else:
			display.append(d)
		display = display[0:k]
	elif ty == 2:
		if d in display:
			print('YES')
		else:
			print('NO')


import heapq
(n, k, qs) = map(int, input().split())
arr = [int(i) for i in input().split()]
d = []
for i in range(qs):
	(q, ind) = map(int, input().split())
	if q == 1:
		heapq.heappush(d, (arr[ind - 1], ind))
	if len(d) > k:
		heapq.heappop(d)
	if q == 2:
		if (arr[ind - 1], ind) in d:
			print('YES')
		else:
			print('NO')


I = lambda : map(int, input().split())
(n, k, q) = I()
T = list(I())
A = []
for _ in range(q):
	(t, i) = I()
	a = (T[i - 1], i)
	if t < 2:
		A.append(a)
		A.sort(reverse=True)
		A = A[:k]
	else:
		print('YES' if a in A else 'NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		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 = os.read(self._fd, max(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 = os.read(self._fd, max(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:
			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')
(n, k, q) = map(int, input().split())
arr = list(map(int, input().split()))
dis = []
for i in range(q):
	(t, id) = map(int, input().split())
	if t == 1:
		if len(dis) == k:
			if arr[id - 1] >= dis[0][0]:
				dis[0] = (arr[id - 1], id)
		else:
			dis.append((arr[id - 1], id))
		dis.sort()
	else:
		var = [dis[i][1] for i in range(len(dis))]
		if id in var:
			print('YES')
		else:
			print('NO')


from collections import deque
from math import *
(n, k, q) = map(int, input().split())
A = []
lens = 0
B = list(map(int, input().split()))
for i in range(q):
	(per1, per2) = map(int, input().split())
	if per1 == 1:
		if lens < k:
			A.append([per2, B[per2 - 1]])
			lens += 1
		else:
			c = float('infinity')
			r = 0
			for i in range(k):
				if A[i][1] < c:
					c = A[i][1]
					r = i
			if B[per2 - 1] > A[r][1]:
				A[r] = [per2, B[per2 - 1]]
	else:
		si = True
		for i in range(lens):
			if A[i][0] == per2:
				si = False
				break
		if si:
			print('NO')
		else:
			print('YES')


lll = input().split()
n = int(lll[0])
k = int(lll[1])
q = int(lll[2])
ll = input().split()
l = list(map(int, ll))
s = []
u = 0
for i in range(k):
	s.append((0, 0))
while u < q:
	u += 1
	o = input().split()
	if o[0] == '1':
		t = (int(o[1]), l[int(o[1]) - 1])
		for j in range(k):
			if t[1] > s[j][1]:
				s.pop()
				s.insert(j, t)
				break
	elif o[0] == '2':
		rr = 0
		for j in range(k):
			if s[j][0] == int(o[1]):
				print('YES')
				rr = 1
				break
		if rr == 0:
			print('NO')


(n, k, q) = [int(s) for s in input().split()]
friend_list = [int(s) for s in input().split()]
active_friends_id = dict()
active_friends = [-1 for i in range(k)]
min_value = 0
min_ind = -1
min_key = -1
count = 0
tmp_ind = 0
for i in range(q):
	(req, id) = [int(s) for s in input().split()]
	id -= 1
	if req == 1:
		if count != k or friend_list[id] > min_value:
			if count == k:
				active_friends_id[min_ind] = id
				active_friends[min_ind] = friend_list[id]
				min_value = min(active_friends)
				min_ind = active_friends.index(min_value)
			else:
				active_friends_id[tmp_ind] = id
				active_friends[tmp_ind] = friend_list[id]
				tmp_ind += 1
				count += 1
				if count == k:
					min_value = min(active_friends)
					min_ind = active_friends.index(min_value)
	elif id in active_friends_id.values():
		print('YES')
	else:
		print('NO')


from heapq import heappush, heapreplace
(n, k, q) = map(int, input().split())
a = list(map(int, input().split()))
window = []
window_set = set()
min_pr = 10 ** 10
min_pr_id = 0
for i in range(q):
	(type, id) = map(int, input().split())
	if type == 1:
		if len(window) < k:
			heappush(window, (a[id - 1], id))
			min_pr = min(min_pr, a[id - 1])
		elif a[id - 1] > min_pr:
			heapreplace(window, (a[id - 1], id))
			min_pr = window[0][0]
	elif id in [i[1] for i in window]:
		print('YES')
	else:
		print('NO')


import operator as op
from queue import PriorityQueue
import heapq

class StdReader:

	def read_int(self):
		return int(self.read_string())

	def read_ints(self, sep=None):
		return [int(i) for i in self.read_strings(sep)]

	def read_float(self):
		return float(self.read_string())

	def read_floats(self, sep=None):
		return [float(i) for i in self.read_strings(sep)]

	def read_string(self):
		return input()

	def read_strings(self, sep=None):
		return self.read_string().split(sep)
reader = StdReader()

def main():
	(n, k, q) = reader.read_ints()
	t = reader.read_ints()
	queue = []
	qsize = 0
	for i in range(q):
		(qt, qid) = reader.read_ints()
		qid -= 1
		if qt == 1:
			if len(queue) == k:
				heapq.heappushpop(queue, (t[qid], qid))
			else:
				heapq.heappush(queue, (t[qid], qid))
		else:
			box = [i[1] for i in queue]
			if qid in box:
				print('YES')
			else:
				print('NO')
main()


(a, b, c) = [int(i) for i in input().split()]
s = [int(i) for i in input().split()]
d = []
m = 0
j = 1
ans = []
for i in range(c):
	(x, y) = [int(i) for i in input().split()]
	if x == 1:
		t = s[y - 1]
		if j == 1:
			j = 0
			d += [t]
			m = t
			continue
		if len(d) < b:
			d += [t]
			if len(d) == b:
				m = min(d)
		elif t > m:
			d += [t]
			d.remove(m)
			m = min(d)
	elif s[y - 1] in d:
		ans += ['YES']
	else:
		ans += ['NO']
print('\n'.join(ans))


(n, k, q) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [0]
for i in range(q):
	(t, d) = [int(x) for x in input().split()]
	if t == 2:
		if d in b:
			print('YES')
		else:
			print('NO')
	if b[0] == 0:
		b.remove(0)
		b.append(d)
	if t == 1:
		for y in range(len(b)):
			if a[d - 1] > a[b[y] - 1]:
				b.insert(y, d)
				break
		if a[d - 1] < a[b[len(b) - 1] - 1]:
			b.append(d)
		if len(b) == k + 1:
			b.pop(len(b) - 1)


(n, k, q) = map(int, input().split())
a = [*map(int, input().split())]
l = [0] * k
for i in range(q):
	(w, e) = map(int, input().split())
	e = a[e - 1]
	if w == 1:
		o = min(l)
		if e > o:
			l[l.index(o)] = e
	else:
		print('YES' if e in l else 'NO')


(n, k, q) = list(map(int, input().split()))
t = list(map(int, input().split()))
friend = []
for i in range(0, q):
	(a, b) = list(map(int, input().split()))
	if a == 1:
		for o in range(0, min(len(friend), k)):
			if friend[o] < t[b - 1]:
				friend[o:o] = [t[b - 1]]
				break
		if len(friend) >= k:
			friend = friend[0:k]
		if len(friend) < k and friend.count(t[b - 1]) == 0:
			friend.append(t[b - 1])
	if a == 2:
		if friend.count(t[b - 1]) >= 1:
			print('YES')
		else:
			print('NO')


import heapq
from heapq import heappush, heappop
(n, k, q) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = []
j = 0
for i in range(q):
	(p, s) = [int(i) for i in input().split()]
	if p == 1:
		j += 1
		heappush(b, a[s - 1])
		if j > k:
			heappop(b)
			j -= 1
	elif p == 2:
		if a[s - 1] in b:
			print('YES')
		else:
			print('NO')


import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def binsearch(nums, target):
	left = 0
	right = len(nums) - 1
	while left <= right:
		mid = (left + right) // 2
		if nums[mid] == target:
			return mid
		elif nums[mid] > target:
			right = mid - 1
		elif nums[mid] < target:
			left = mid + 1
	return left
(n, k, q) = map(int, input().split())
rels = [int(z) for z in input().split()]
online = []
for query in range(q):
	(t, f) = map(int, input().split())
	if t == 1:
		pl = binsearch(online, rels[f - 1])
		online.insert(pl, rels[f - 1])
	if t == 2:
		if binsearch(online, rels[f - 1]) >= len(online) - k and rels[f - 1] in online:
			print('YES')
		else:
			print('NO')


(n, k, q) = input().split()
n = int(n)
k = int(k)
q = int(q)
list_friend = input().split()
for i in range(n):
	list_friend[i] = int(list_friend[i])
list_show = [0] * k
for a in range(q):
	(tp, num) = input().split()
	tp = int(tp)
	num = int(num)
	if tp == 1:
		for i in range(k):
			if list_show[i] < list_friend[num - 1]:
				list_show.insert(i, list_friend[num - 1])
				list_show.pop()
				break
	elif list_friend[num - 1] in list_show:
		print('YES')
	else:
		print('NO')


def siftup(ind):
	global tree
	while ind != 1 and frendly[tree[ind]] < frendly[tree[ind // 2]]:
		(tree[ind], tree[ind // 2]) = (tree[ind // 2], tree[ind])
		ind //= 2

def siftdown(ind):
	global tree
	while ind * 2 + 1 <= len(tree) - 1 and (frendly[tree[ind]] > frendly[tree[ind * 2]] or frendly[tree[ind]] > frendly[tree[ind * 2 + 1]]):
		if frendly[tree[ind * 2]] > frendly[tree[ind * 2 + 1]]:
			(tree[ind], tree[ind * 2 + 1]) = (tree[ind * 2 + 1], tree[ind])
			ind = ind * 2 + 1
		else:
			(tree[ind], tree[ind * 2]) = (tree[ind * 2], tree[ind])
			ind *= 2
	if ind * 2 <= len(tree) - 1 and frendly[tree[ind]] > frendly[tree[ind * 2]]:
		(tree[ind], tree[ind * 2]) = (tree[ind * 2], tree[ind])
		ind *= 2
(n, k, q) = map(int, input().split())
frendly = [0] + list(map(int, input().split()))
bearsout = set([i for i in range(1, n + 1)])
tree = [0]
for i in range(q):
	(lab, b) = map(int, input().split())
	if lab == 1:
		if len(tree) > k:
			if frendly[b] > frendly[tree[1]]:
				bearsout.discard(b)
				bearsout.add(tree[1])
				tree[1] = b
				siftdown(1)
		else:
			tree.append(b)
			bearsout.discard(b)
			siftup(len(tree) - 1)
	elif b in bearsout:
		print('NO')
	else:
		print('YES')


(n, k, q) = map(int, input().split())
F = [-1] + list(map(int, input().split()))
now = []
for _ in range(q):
	(t, i) = map(int, input().split())
	if t == 1:
		now += [(F[i], i)]
		now.sort()
		now = now[-k:]
	elif (F[i], i) in now:
		print('YES')
	else:
		print('NO')


import heapq
(n, k, q) = [int(x) for x in input().split()]
t = [int(x) for x in input().split()]
heap = []
for i in range(q):
	(query_type, query_id) = [int(x) for x in input().split()]
	if query_type == 1:
		if len(heap) < k or t[query_id - 1] > heap[0]:
			if len(heap) == k:
				heapq.heappop(heap)
			heapq.heappush(heap, t[query_id - 1])
	else:
		print('YES' if t[query_id - 1] in heap else 'NO')


import queue
q = queue.PriorityQueue()
cnt = 0
(n, k, m) = map(int, input().split())
t = list(map(int, input().split()))
o = [0 for i in range(n)]
min = -1
out = []
for i in range(m):
	(type, id) = map(int, input().split())
	id -= 1
	if type == 1:
		q.put(t[id])
		o[id] = True
		if cnt == k:
			tmp = q.get()
			min = max(min, tmp)
		else:
			cnt += 1
	else:
		out.append('YES' if o[id] and t[id] > min else 'NO')
print('\n'.join(out))


[n, k, q] = list(map(int, input().split()))
lt = list(map(int, input().split()))
disp = list()
result = []
for i in range(q):
	[a, b] = list(map(int, input().split()))
	if a == 1:
		disp.append(lt[b - 1])
		disp.sort(reverse=True)
		if len(disp) > k:
			disp.pop()
	elif lt[b - 1] in disp:
		print('YES')
	else:
		print('NO')


(n, k, q) = [int(i) for i in input().split()]
t = [int(i) for i in input().split()]
dis = []
for _ in range(q):
	(typ, ID) = [int(j) for j in input().split()]
	if typ == 1:
		if len(dis) == 0:
			dis.append(ID)
		else:
			for i in range(len(dis) - 1, -1, -1):
				if t[dis[i] - 1] > t[ID - 1]:
					dis.insert(i + 1, ID)
					break
			else:
				dis = [ID] + dis
			if len(dis) > k:
				dis.pop()
	elif typ == 2:
		if ID in dis:
			print('YES')
		else:
			print('NO')


(n, size, tasks) = map(int, input().split())
friends = list(map(int, input().split()))
online = list()
for i in range(tasks):
	(type, id) = map(int, input().split())
	id -= 1
	if type == 1:
		adds = friends[id]
		online = sorted(online + [adds], reverse=True)
		if len(online) > size:
			del online[-1]
	else:
		flag_oh_my_god_why = False
		search = friends[id]
		for bear in online:
			if bear == search:
				flag_oh_my_god_why = True
				break
		if flag_oh_my_god_why == False:
			print('NO')
		else:
			print('YES')


(n, k, q) = map(int, input().strip().split(' '))
lst = list(map(int, input().strip().split(' ')))
p = []
c = 0
for i in range(q):
	(t, d) = map(int, input().strip().split(' '))
	if t == 1:
		if c < k:
			p.append(lst[d - 1])
			c += 1
		else:
			ind = p.index(min(p))
			if lst[d - 1] > min(p):
				del p[ind]
				p.append(lst[d - 1])
	elif lst[d - 1] in p:
		print('YES')
	else:
		print('NO')


def type1(idi):
	global mnoj, n, k, q, t
	if len(mnoj) < k:
		mnoj.add(t[idi])
	else:
		mn = min(mnoj)
		if t[idi] > mn:
			mnoj.remove(mn)
			mnoj.add(t[idi])

def main():
	global mnoj, n, k, q, t
	(n, k, q) = map(int, input().split())
	t = list(map(int, input().split()))
	mnoj = set()
	for i in range(q):
		(typei, idi) = map(int, input().split())
		idi -= 1
		if typei == 1:
			type1(idi)
		elif t[idi] in mnoj:
			print('YES')
		else:
			print('NO')
main()