Nobody knows, but $N$ frogs live in Chef's garden.
Now they are siting on the X-axis and want to speak to each other. One frog can send a message to another one if the distance between them is less or equal to $K$.
Chef knows all $P$ pairs of frogs, which want to send messages. Help him to define can they or not!
Note : More than $1$ frog can be on the same point on the X-axis.

-----Input-----
- The first line contains three integers $N$, $K$ and $P$.
- The second line contains $N$ space-separated integers $A_1$, $A_2$, …, $A_N$ denoting the x-coordinates of frogs".
- Each of the next $P$ lines contains two integers $A$ and $B$ denoting the numbers of frogs according to the input.

-----Output-----
For each pair print "Yes" without a brackets if frogs can speak and "No" if they cannot.

-----Constraints-----
- $1 \le N, P \le 10^5$
- $0 \le A_i, K \le 10^9$
- $1 \le A, B \le N$

-----Example-----

-----Sample Input:-----
5 3 3
0 3 8 5 12
1 2
1 3
2 5

-----Sample Output:-----
Yes
Yes
No

-----Explanation-----
- 
For pair $(1, 2)$ frog $1$ can directly speak to the frog $2$ as the distance between them is $3 - 0 = 3 \le K$ . 
- 
For pair $(1, 3)$ frog $1$ can send a message to frog $2$, frog $2$ can send it to frog $4$ and it can send it to frog $3$.
- 
For pair $(2, 5)$ frogs can't send a message under current constraints.

Starter code:

Solutions:
# cook your dish here
n, k, p = [int(i) for i in input().split()]
n_sep = list(map(int, input().split()))
count = 0
sep_sort = sorted(n_sep)
hashing = {sep_sort[0]: 0}

for j in range(1, n):
 if (abs(sep_sort[j] - sep_sort[j - 1]) > k):
  count += 1
 hashing[sep_sort[j]] = count
#print(hashing)
for i in range(p):
 pair = list(map(int, input().split()))
 
 if hashing[n_sep[pair[1] - 1]] == hashing[n_sep[pair[0] - 1]]:
  print("Yes")
 else:
  print("No")


# cook your dish here
n, k, p = map(int, input().split())
f = list(map(int, input().split()))
seq = sorted(set(f))
m = 0
seq1 = {seq[0]: 0}
for i in range(1, len(seq)):
 if seq[i]-seq[i-1] > k:
  m += 1
 seq1[seq[i]] = m
while p > 0:
 i, j = map(int, input().split())
 i, j = f[i-1], f[j-1]
 if seq1[i] == seq1[j]:
  print('Yes')
 else:
  print('No')
 p -= 1

class union_find:
 def __init__(self,N):
  self.parent = {}
  self.rank = []
  for i in range(N):
   self.parent[i] = i
   self.rank.append(0)

 def find(self,x):
  y = x
  while(x!=self.parent[x]):
   x = self.parent[x]
  self.parent[y] = x
  return x

 def union(self,x,y):
  px = self.find(x)
  py = self.find(y)
  if(px==py):
   return
  else:
   if(self.rank[px]>self.rank[py]):
    self.parent[py] = px
   elif(self.rank[px]<self.rank[py]):
    self.parent[px] = py
   else:
    self.parent[py] = px
    self.rank[px] += 1

N,K,P = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
ans = []

uf = union_find(N)

Y = []
for i in range(N):
 Y.append((X[i],i))
Y.sort()

for i in range(N-1):
 if(Y[i+1][0]-Y[i][0]<=K):
  uf.union(Y[i][1],Y[i+1][1])

A = []
B = []

for i in range(P):
 a,b = [int(i) for i in input().split()]
 A.append(a-1)
 B.append(b-1)

for i in range(P):
 pa = uf.find(A[i])
 pb = uf.find(B[i])
 if(pa==pb):
  ans.append('Yes')
 else:
  ans.append('No')

for i in ans:
 print(i)


from collections import defaultdict
def precompute(arr,n,k):
 nonlocal maxdistance
 arr = list(enumerate(arr))
 arr.sort(key = lambda x:-x[1])
 maxdistance[arr[0][0]] = arr[0][1]+k
 for i in range(1,n):
  if arr[i-1][1]-arr[i][1]<=k:
   maxdistance[arr[i][0]] = maxdistance[arr[i-1][0]]
  else:
   maxdistance[arr[i][0]] = arr[i][1]+k
def answer(x,y):
 nonlocal maxdistance
 if maxdistance[x-1]==maxdistance[y-1]:
  return "Yes"
 return "No"
maxdistance = defaultdict(int)
n,k,q = list(map(int,input().split()))
arr = list(map(int,input().split()))
precompute(arr,n,k)
for _ in range(q):
 x,y = list(map(int,input().split()))
 print(answer(x,y))
 


n, k, p = map(int, input().split())
f = list(map(int, input().split()))
seq = sorted(set(f))
m = 0
seq1 = {seq[0]: 0}
for i in range(1, len(seq)):
 if seq[i]-seq[i-1] > k:
  m += 1
 seq1[seq[i]] = m
while p > 0:
 i, j = map(int, input().split())
 i, j = f[i-1], f[j-1]
 if seq1[i] == seq1[j]:
  print('Yes')
 else:
  print('No')
 p -= 1

# cook your dish here
from collections import defaultdict

def preCompute(arr, n, K):
 nonlocal maxDistance
 arr = list(enumerate(arr))
 arr.sort(key = lambda x: -x[1])
 # print(arr)
 maxDistance[arr[0][0]] = arr[0][1] + K
 for i in range(1, n):
  if arr[i-1][1] - arr[i][1] <= K:
   maxDistance[arr[i][0]] = maxDistance[arr[i-1][0]]
  else:
   maxDistance[arr[i][0]] = arr[i][1] + K

def answer(x, y):
 # print(maxDistance)
 if maxDistance[x-1] == maxDistance[y-1]:
  return "Yes"
 return "No"


maxDistance = defaultdict(int)
(n, k, p) = map(int, input().strip().split())
arr = list(map(int, input().strip().split()))
preCompute(arr, n, k)
for _ in range(p):
 (x, y) = map(int, input().strip().split())
 print(answer(x, y))

# cook your dish here
from collections import defaultdict
def preCompute(arr, n, K):
 nonlocal maxDistance
 arr = list(enumerate(arr))
 arr.sort(key = lambda x: -x[1])
 # print(arr)
 maxDistance[arr[0][0]] = arr[0][1] + K
 for i in range(1, n):
  if arr[i-1][1] - arr[i][1] <= K:
   maxDistance[arr[i][0]] = maxDistance[arr[i-1][0]]
  else:
   maxDistance[arr[i][0]] = arr[i][1] + K

def answer(x, y):
 # print(maxDistance)
 if maxDistance[x-1] == maxDistance[y-1]:
  return "Yes"
 return "No"


maxDistance = defaultdict(int)
(n, k, p) = map(int, input().strip().split())
arr = list(map(int, input().strip().split()))
preCompute(arr, n, k)
for _ in range(p):
 (x, y) = map(int, input().strip().split())
 print(answer(x, y))

# cook your dish here
n,k,p=map(int,input().split())
x=[int(x) for x in input().split()]
l=sorted(set(x))
m=0
l1={l[0]:0}
for i in range(1,len(l)):
 if l[i]-l[i-1]>k:
  m+=1
 l1[l[i]]=m
for _ in range(p):
 a,b=map(int,input().split())
 a,b=x[a-1],x[b-1]
 print('Yes') if l1[a]==l1[b] else print('No')
 
 

n,k,p=list(map(int,input().split()))
a=list(map(int,input().split()))
newar=[]
for i in range(n):
 newar.append((a[i],i))
newar.sort(key=lambda x:x[0])
revmap=[0]*n
ans=[0]*n
ctr=1

ans[0]=ctr
for i in range(n):
 revmap[newar[i][1]]=i

 if i!=n-1:
  if(newar[i+1][0]-newar[i][0])<=k:
   ans[i+1]=ctr
  else:
   ctr+=1
   ans[i+1]=ctr
for _ in range(p):
 A,B=list(map(int,input().split()))
 if ans[revmap[A-1]]==ans[revmap[B-1]]:
  print('Yes')
 else:
  print('No')


from sys import stdin,stdout
from math import gcd,log2,log10,floor;
import math;
from collections import defaultdict,OrderedDict
from bisect import bisect_left
# import numpy as np
# input=stdin.readline
# print=stdout.write
n,k,p = [int(i) for i in input().split()]
a=list(map(int,input().split()))
asort=a[:]
asort.sort()
dict=defaultdict(int)
theta=1;
dict[asort[0]]=1;
for i in range(1,n):
 if asort[i]-asort[i-1]<=k:
  dict[asort[i]]=theta;
 else:
  theta+=1;
  dict[asort[i]]=theta;
for i in range(p):
 alpha,beta=list(map(int,input().split()))
 alpha-=1;
 beta-=1;
 if dict[a[alpha]]==dict[a[beta]]:
  print("Yes")
 else:
  print("No")
# print(dict)
 






# cook your dish here
n,k,p=map(int,input().split())
x=[int(x) for x in input().split()]
l=sorted(set(x))
m=0
l1={l[0]:0}
for i in range(1,len(l)):
 if l[i]-l[i-1]>k:
  m+=1
 l1[l[i]]=m
for _ in range(p):
 a,b=map(int,input().split())
 a,b=x[a-1],x[b-1]
 print('Yes') if l1[a]==l1[b] else print('No')
 
 

n,k,p=map(int,input().split())
x=[int(x) for x in input().split()]
l=sorted(set(x))
m=0
l1={l[0]:0}
for i in range(1,len(l)):
 if l[i]-l[i-1]>k:
  m+=1
 l1[l[i]]=m
for _ in range(p):
 a,b=map(int,input().split())
 a,b=x[a-1],x[b-1]
 print('Yes') if l1[a]==l1[b] else print('No')
 
 

n,k,p=map(int,input().split())
x=[int(x) for x in input().split()]
l=sorted(set(x))
m=0
l1={l[0]:0}
for i in range(1,len(l)):
 if l[i]-l[i-1]>k:
  m+=1
 l1[l[i]]=m
for _ in range(p):
 a,b=map(int,input().split())
 a,b=x[a-1],x[b-1]
 print('Yes') if l1[a]==l1[b] else print('No')

n,k,p=map(int,input().split())
x=[int(x) for x in input().split()]
l=sorted(set(x))
m=0
l1={l[0]:0}
for i in range(1,len(l)):
 if l[i]-l[i-1]>k:
  m+=1
 l1[l[i]]=m
for _ in range(p):
 a,b=map(int,input().split())
 a,b=x[a-1],x[b-1]
 print('Yes') if l1[a]==l1[b] else print('No')

n,k,p=list(map(int,input().strip().split()))
list1=list(map(int,input().strip().split()))
list2=sorted(list1)

map1=dict()
curr=list2[0]
index=0
for i in range(1,n):
 if list2[i]-list2[i-1]>k:
  for j in range(index,i):
   map1[list2[j]]=list2[i-1]
  curr=list2[i]
  index=i
  
for j in range(index,n):
 map1[list2[j]]=list2[n-1]


for _ in range(p):
 a,b=list(map(int,input().strip().split()))
 pos1=list1[a-1]
 pos2=list1[b-1]
 start=min(pos1,pos2)
 end=max(pos1,pos2)
 
 if map1[start]>=end:
  print("Yes")
 else:
  print("No")


 



def solve():
 n, k, p = list(map(int, input().split()))
 arr = list(map(int, input().split()))
 new = []
 for i in range(n):
  new.append([arr[i], i])
 new1 = sorted(new, key=lambda x: x[0])
 po = 0
 store = [0] * n
 for i in range(1, n):
  if (new1[i][0] - new1[i - 1][0]) > k:
   po += 1
  store[new1[i][1]] = po
 for i in range(p):
  p1, p2 = list(map(int, input().split()))
  if store[p1 - 1] == store[p2 - 1]:
   print("Yes")
  else:
   print("No")


def __starting_point():
 solve()

__starting_point()

n,k,p=map(int,input().split())
l=list(map(int,input().split()))
t_1=[]
for i in range(n):
 t_1.append([i,l[i]])
t_1=sorted(t_1,key=lambda x:x[1],reverse=True)
dis={}

for i in range(n):
 if i==0:
  dis[i]=t_1[i][1]+k
  continue
 if (t_1[i-1][1]-t_1[i][1])<=k:
  dis[i]=dis[i-1]
 else:
  dis[i]=t_1[i][1]+k
trans={}
for i in range(n):
 trans[t_1[i][0]]=i
for i in range(p):
 a,b=map(int,input().split())
 t_2=a-1
 t_3=b-1
 if dis[trans[t_2]]==dis[trans[t_3]]:
  print('Yes')
 else:
  print('No')

n,k,q = map(int,input().split())
b = list(map(int,input().split()))
a = sorted(b)
ans = {}
ans[a[0]] = a[0]
start = a[0]
for i in range(n-1):
 if a[i+1]-a[i]<=k:
  ans[a[i+1]] = start
 else:
  start = a[i+1]
  ans[a[i+1]] = start
#print(b,a)
for u in range(q):
 x,y = map(int,input().split())
 if ans[max(b[y-1],b[x-1])]<=min(b[x-1],b[y-1]):
  print("Yes")
 else:
  print("No")

# cook your dish here
n,k,q = list(map(int,input().split()))
b = list(map(int,input().split()))
a = sorted(b)
ans = {}
ans[a[0]] = a[0]
start = a[0]
for i in range(n-1):
 if a[i+1]-a[i]<=k:
  ans[a[i+1]] = start
 else:
  start = a[i+1]
  ans[a[i+1]] = start
#print(b,a)
for u in range(q):
 x,y = list(map(int,input().split()))
 if ans[max(b[y-1],b[x-1])]<=min(b[x-1],b[y-1]):
  print("Yes")
 else:
  print("No")


n,k,q = list(map(int,input().split()))
b = list(map(int,input().split()))
a = sorted(b)
ans = {}
ans[a[0]] = a[0]
start = a[0]
for i in range(n-1):
 if a[i+1]-a[i]<=k:
  ans[a[i+1]] = start
 else:
  start = a[i+1]
  ans[a[i+1]] = start
#print(b,a)
for u in range(q):
 x,y = list(map(int,input().split()))
 if ans[max(b[y-1],b[x-1])]<=min(b[x-1],b[y-1]):
  print("Yes")
 else:
  print("No")


# cook your dish here
from sys import stdin
n,k,p=map(int,stdin.readline().split())
list1=list(map(int,stdin.readline().split()))
list2=[]
for i in range(n):
 list2.append((list1[i],i+1))
list2.sort(reverse=True)
dict1={}
dict1[list2[0][1]]=list2[0][0]+k
prev=list2[0]
for each in list2[1:]:
 if each[0]+k<prev[0]:
  dict1[each[1]]=each[0]+k
  prev=each
 else:
  dict1[each[1]]=dict1[prev[1]]
  prev=each
#print(dict1)
for j in range(p):
 a,b=map(int,stdin.readline().split())
 if dict1[a]==dict1[b]:
  print("Yes")
 else:
  print("No")

# cook your dish here
n,k,p=list(map(int,input().split()))
coor=list(map(int,input().split()))
forw=[]
sort_coor=[]
for i,each in enumerate(coor):
 sort_coor.append((each,i))
sort_coor.sort()
j=n-2
msg={}
max1=sort_coor[n-1][0]+k
msg[sort_coor[n-1][1]]=max1
for i in range(n-1,0,-1):
 j=i-1
 if sort_coor[i][0]-sort_coor[j][0]<=k:
  msg[sort_coor[j][1]]=max1
 else:
  max1=sort_coor[j][0]+k
  msg[sort_coor[j][1]]=max1

for i in range(p):
 a,b=map(int,input().split())
 if msg[b-1]==msg[a-1]:
  print("Yes")
 else:
  print("No")