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 t_{i}. The bigger this value is, the better the friendship is. No two friends have the same value t_{i}.

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 t_{i}.

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 t_1, t_2, ..., t_{n} (1 ≤ t_{i} ≤ 10^9) where t_{i} describes how good is Limak's relation with the i-th friend.

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

It's guaranteed that no two queries of the first type will have the same id_{i} becuase one friend can't become online twice. Also, it's guaranteed that at least one query will be of the second type (type_{i} = 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 3" — Friend 3 becomes online.  "2 4" — We should check if friend 4 is displayed. He isn't even online and thus we print "NO".  "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".  "1 1" — Friend 1 becomes online. The system now displays both friend 1 and friend 3.  "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 (t_1 < t_2, t_3) so friend 1 won't be displayed  "2 1" — Print "NO".  "2 2" — Print "YES".  "2 3" — Print "YES".

Difficulty: EASY

Solutions:
def ke(i):
	return a[i - 1]
(n, k, q) = list(map(int, input().split()))
a = list(map(int, input().split()))
p = []
for i in range(q):
	(b, id) = list(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')


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')


(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')


(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')


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)


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')


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)


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)


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())


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 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) = 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')


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()


from heapq import heappush, heapreplace
(n, k, q) = list(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) = list(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')


(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 = 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')


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')


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')


(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')


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()


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, 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) = 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 = 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().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')


(n, k, q) = list(map(int, input().split()))
t = [0] + list(map(int, input().split()))
ts = list()
for i in range(q):
	(typ, idi) = list(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')


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')


import heapq
(n, k, qs) = list(map(int, input().split()))
arr = [int(i) for i in input().split()]
d = []
for i in range(qs):
	(q, ind) = list(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')


(n, k, q) = list(map(int, input().split()))
friends = list(map(int, input().split()))
main = [None] * k
for i in range(q):
	(t, p) = list(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')


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')


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


(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 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))


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])


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')


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')


(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')


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())
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)))


from collections import deque as de
import math
import re
from collections import Counter as cnt
from functools import reduce
from typing import MutableMapping
from itertools import groupby as gb
from fractions import Fraction as fr
from bisect import bisect_left as bl, bisect_right as br

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 binarytodecimal(n):
	return int(n, 2)

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 getProduct(n):
	product = 1
	while n != 0:
		product = product * (n % 10)
		n = n // 10
	return product

def dupconscount(nums):
	element = []
	freque = []
	if not nums:
		return element
	running_count = 1
	for i in range(len(nums) - 1):
		if nums[i] == nums[i + 1]:
			running_count += 1
		else:
			freque.append(running_count)
			element.append(nums[i])
			running_count = 1
	freque.append(running_count)
	element.append(nums[i + 1])
	return (element, freque)

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))

def ceildiv(x, y):
	return (x + y - 1) // y

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

def ii():
	return int(input())

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

def si():
	return list(map(str, input()))

def indic():
	dic = {}
	for (index, value) in enumerate(input().split()):
		dic[int(index) + 1] = int(value)
	return dic
(n, k, q) = di()
t = indic()
checklist = []
while q:
	q -= 1
	(type, id) = di()
	if type == 1:
		if len(checklist) < k:
			checklist.append(t[id])
			checklist.sort()
		elif checklist[0] < t[id]:
			del checklist[0]
			checklist.append(t[id])
			checklist.sort()
	elif t[id] in checklist:
		print('YES')
	else:
		print('NO')


(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)


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()


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()


(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')


(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)


(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')