#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define MOD 1000000007
#define len(x) x.size()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define all(v) v.begin(), v.end()
#define alla(a,n) a, a + n
#define f(i, n) for (int i = 0; i < int(n); i++)
#define g(i, n) for (int i = 0; i < int(n-1); i++)
#define fj(j, n) for (int j = 0; j < int(n); j++)
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<string> vs;

// Driver function to sort the vector elements by
// second element of pair in descending order
bool sortbysecdesc(const pair<int,int> &a,
                   const pair<int,int> &b)
{
       return a.second>b.second;
}

// Driver function to sort the vector elements by
// first element of pair in descending order
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}

// Function to return gcd of a and b
ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

//Function to return lcm of a and b
ll lcm(ll a,ll b)
{
    return (a*b)/gcd(a,b);
}

// Function to find gcd of array of
// numbers
int findGCD(ll a[], ll n)
{
    int result = a[0];
    for (int i = 1; i < n; i++)
    {
        result = gcd(a[i], result);

        if(result == 1)
        {
           return 1;
        }
    }
    return result;
}

int32_t main() {
    fio;

    ll n,m,p,q,r,count=0;
    cin>>n>>m;
    vll a(n+1),b(n);
    for(int i=1;i<=n;i++)
    {
    cin>>a[i];
    }
    vector<string>v;
    while(m--)
    {
        cin>>p>>q>>r;
        count=0;
        for(int i=p;i<=q;i++)
        {
            if(a[i]<a[r])
            count++;

        }
        if(p+count==r)
        cout<<"Yes"<<endl;
        else
        cout<<"No"<<endl;

    }

    return 0 ;

}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define MOD 1000000007
#define len(x) x.size()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define all(v) v.begin(), v.end()
#define alla(a,n) a, a + n
#define f(i, n) for (int i = 0; i < int(n); i++)
#define g(i, n) for (int i = 0; i < int(n-1); i++)
#define fj(j, n) for (int j = 0; j < int(n); j++)
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<string> vs;

// Driver function to sort the vector elements by
// second element of pair in descending order
bool sortbysecdesc(const pair<int,int> &a,
                   const pair<int,int> &b)
{
       return a.second>b.second;
}

// Driver function to sort the vector elements by
// first element of pair in descending order
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}

// Function to return gcd of a and b
ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

//Function to return lcm of a and b
ll lcm(ll a,ll b)
{
    return (a*b)/gcd(a,b);
}

// Function to find gcd of array of
// numbers
int findGCD(ll a[], ll n)
{
    int result = a[0];
    for (int i = 1; i < n; i++)
    {
        result = gcd(a[i], result);

        if(result == 1)
        {
           return 1;
        }
    }
    return result;
}

int32_t main() {
    fio;

    ll n,m,p,q,r,count=0;
    cin>>n>>m;
    vll a(n+1),b(n);
    for(int i=1;i<=n;i++)
    {
    cin>>a[i];
    b[i]=a[i];
    }
    // sort(b.begin(),b.end());
    vector<string>v;
    while(m--)
    {
        cin>>p>>q>>r;
        count=0;
        for(int i=p;i<=q;i++)
        {
            if(a[i]<a[r])
            count++;

        }
        if(p+count==r)
        cout<<"Yes"<<endl;
        else
        cout<<"No"<<endl;

    }

    return 0 ;

}


/*
    AABRA KA DABRA.. !!
*/
#include "bits/stdc++.h"
using namespace std;
typedef long double ld;
#define int long long
#define RAGE ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,n) for(i=0; i <n; i++)
#define repv(i,k,n) for(int i=k; i<=n; i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define endl '\n'
#define deb(x) cout<<#x<<" = "<<x<<endl
#define gcd __gcd
#define inf LLONG_MAX
#define minf LLONG_MIN
const int mod = (int)(1e9+7);

int power(int x,int n)
{
    if(n==0)    return 1;
    if(n==1)    return x%mod;
    if(n%2==0)  {   int y = power(x,n/2)%mod;return (y*y)%mod;}
    if(n&1)     {   int y = power(x,n-1);return (x%mod * y%mod)%mod;}
    return 0;
}

int dx[]    =  {-1, 0, 1,  0, -1, -1, 1,  1};
int dy[]    =  { 0, 1, 0, -1, -1,  1, 1, -1};
const int maxn = 100005;

/*
    ╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩╦═╩═╦═╩═╦═╩═╦═╩═╦═╩╦═╩═╦═╩═╦═╩═╦═╩═╦═╩╦═╩═╦═╩═╦
*/

void solve()
{
    int n,i,j,k,m;
    cin>>n>>m;
    vector<int> ar(n);
    rep(i,n)
        cin>>ar[i];
    while(m--)
    {
        int l,r,x;
        cin>>l>>r>>x;
        l-- ,r--, x--;
        vector<int> temp(all(ar));
        sort(temp.begin()+l,temp.begin()+r+1);
        if(temp[x]!=ar[x])
            cout<<"No"<<endl;
        else
            cout<<"Yes"<<endl;
    }
}
signed main()
{
    RAGE;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    int t=1;
    //  cin>>t;
    while(t--)
        solve();

    #ifndef ONLINE_JUDGE
        cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif
    return 0;
}


/*
    AABRA KA DABRA.. !!
*/
#include "bits/stdc++.h"
using namespace std;
typedef long double ld;
#define int long long
#define RAGE ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,n) for(i=0; i <n; i++)
#define repv(i,k,n) for(int i=k; i<=n; i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define endl '\n'
#define deb(x) cout<<#x<<" = "<<x<<endl
#define gcd __gcd
#define inf LLONG_MAX
#define minf LLONG_MIN
const int mod = (int)(1e9+7);

int power(int x,int n)
{
    if(n==0)    return 1;
    if(n==1)    return x%mod;
    if(n%2==0)  {   int y = power(x,n/2)%mod;return (y*y)%mod;}
    if(n&1)     {   int y = power(x,n-1);return (x%mod * y%mod)%mod;}
    return 0;
}

int dx[]    =  {-1, 0, 1,  0, -1, -1, 1,  1};
int dy[]    =  { 0, 1, 0, -1, -1,  1, 1, -1};
const int maxn = 100005;

/*
    ╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩╦═╩═╦═╩═╦═╩═╦═╩═╦═╩╦═╩═╦═╩═╦═╩═╦═╩═╦═╩╦═╩═╦═╩═╦
*/

void solve()
{
    int n,i,j,k,m;
    cin>>n>>m;
    vector<int> ar(n);
    rep(i,n)
        cin>>ar[i];
    while(m--)
    {
        int l,r,x;
        cin>>l>>r>>x;
        l-- ,r--, x--;
        int cnt=0;
        repv(i,l,r)
        {
            if(ar[i]<ar[x])
                cnt++;
        }
        if(l+cnt==x)
            cout<<"Yes\n";
        else
            cout<<"No\n";
    }
}
signed main()
{
    RAGE;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    int t=1;
    //  cin>>t;
    while(t--)
        solve();

    #ifndef ONLINE_JUDGE
        cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif
    return 0;
}


/*
    AABRA KA DABRA.. !!
*/
#include "bits/stdc++.h"
using namespace std;
typedef long double ld;
#define int long long
#define RAGE ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,n) for(i=0; i <n; i++)
#define repv(i,k,n) for(int i=k; i<=n; i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define endl '\n'
#define deb(x) cout<<#x<<" = "<<x<<endl
#define gcd __gcd
#define inf LLONG_MAX
#define minf LLONG_MIN
const int mod = (int)(1e9+7);

int power(int x,int n)
{
    if(n==0)    return 1;
    if(n==1)    return x%mod;
    if(n%2==0)  {   int y = power(x,n/2)%mod;return (y*y)%mod;}
    if(n&1)     {   int y = power(x,n-1);return (x%mod * y%mod)%mod;}
    return 0;
}

int dx[]    =  {-1, 0, 1,  0, -1, -1, 1,  1};
int dy[]    =  { 0, 1, 0, -1, -1,  1, 1, -1};
const int maxn = 100005;

/*
    ╩═╦═╩═╦═╩═╦═╩═╦═╩═╦═╩╦═╩═╦═╩═╦═╩═╦═╩═╦═╩╦═╩═╦═╩═╦═╩═╦═╩═╦═╩╦═╩═╦═╩═╦
*/

void solve()
{
    int n,i,j,k,m;
    cin>>n>>m;
    vector<int> ar(n);
    rep(i,n)
        cin>>ar[i];
    while(m--)
    {
        int l,r,x;
        cin>>l>>r>>x;
        l-- ,r--, x--;
        vector<int> temp(all(ar));
        sort(temp.begin()+l,temp.begin()+r+1);
        if(temp[x]!=ar[x])
            cout<<"NO"<<endl;
        else
            cout<<"YES"<<endl;
    }
}
signed main()
{
    RAGE;
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    int t=1;
    //  cin>>t;
    while(t--)
        solve();

    #ifndef ONLINE_JUDGE
        cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif
    return 0;
}


#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
typedef long long ll;
using namespace std;
const int N=1e5+5;
int main() {
	int n,m;scanf("%d%d",&n,&m);
	int arr[n+1] , idx[n+1];
	for (int i = 1; i <=n; ++i){
		scanf("%d",arr+i);
		idx[arr[i]]=i;
	}
	while(m--){
		int l,r,x;
		scanf("%d%d%d",&l,&r,&x);
		int t[n+1] , ii = l;
		for (int i = 1; i <= n; ++i){
			if(idx[i]>=l && idx[i]<=r){
				t[ii++] = i;
			}
		}
		puts(t[x]==arr[x]?"YES":"NO");
	}
}


#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
typedef long long ll;
using namespace std;
const int N=1e5+5;
int main() {
	int n,m;scanf("%d%d",&n,&m);
	int arr[n+1] , idx[n+1];
	for (int i = 1; i <=n; ++i){
		scanf("%d",arr+i);
		idx[arr[i]]=i;
	}
	while(m--){
		int l,r,x;
		scanf("%d%d%d",&l,&r,&x);
		int t[n+1] , ii = l;
		for (int i = 1; i <= n; ++i){
			if(idx[i]>=l && idx[i]<=r){
				t[ii++] = i;
			}
		}
		puts(t[x]==a[x]?"YES":"NO");
	}
}


#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
typedef long long ll;
using namespace std;
const int N=1e5+5;
int main() {
	int n,m;scanf("%d%d",&n,&m);
	int arr[n+1] , idx[n+1];
	for (int i = 1; i <=n; ++i){
		scanf("%d",arr+i);
		idx[arr[i]]=i;
	}
	while(m--){
		int l,r,x;
		scanf("%d%d%d",&l,&r,&x);
		int t[n+1] , ii = l;
		for (int i = 1; i <= n; ++i){
			if(idx[i]>=l && idx[i]<=r){
				t[ii++] = i;
			}
		}
		puts(t[x]==arr[x]?"Yes":"No");
	}
}


#include<bits/stdc++.h>

 #define f first
 #define s second
 #define pb push_back

using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

bool prime (int x)
{
for(int i=2;i*i<=x;i++)
{
    if(x%i==0){return false;}
}
return true;
}

int main ()
{
    ios::sync_with_stdio(0);
cin.tie(0);

int n;
int m;
cin>>n>>m;
vector<int> v(n);
vector<int>v2(n);
map<int,int> mapa;
for(int i=0;i<n;i++)
{
    cin>>v[i];
    mapa[i+1]=v[i];
    v2[i]=v[i];
}
for(int i=0;i<m;i++)
{
    int l;
    int r;
    int x;
    cin>>l>>r>>x;
int c=0;
    int aux=v[x-1];
    for(int j=l-1;j<r;j++)
    {
        if (aux>v[j]){c++;}
    }
    int tot=(r-l);

    if(v[l-1+c]==v[x-1]){cout<<"Yes"<<endl;}
    else{cout<<"No"<<endl;}

}
return 0;

}


#include<bits/stdc++.h>

 #define f first
 #define s second
 #define pb push_back

using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

bool prime (int x)
{
for(int i=2;i*i<=x;i++)
{
    if(x%i==0){return false;}
}
return true;
}

int main ()
{
    ios::sync_with_stdio(0);
cin.tie(0);

int n;
int m;
cin>>n>>m;
vector<int> v(n);
vector<int>v2(n);
map<int,int> mapa;
for(int i=0;i<n;i++)
{
    cin>>v[i];
    mapa[i+1]=v[i];
    v2[i]=v[i];
}
for(int i=0;i<m;i++)
{
    int l;
    int r;
    int x;
    cin>>l>>r>>x;
   sort(v.begin()+(l-1),v.begin()+(r));
    if(v[x-1]==mapa[x]){cout<<"YES"<<endl;}
    else{cout<<"NO"<<endl;}

for(int i=0;i<n;i++)
{
    v[i]=v2[i];
}

}
return 0;

}


#include<bits/stdc++.h>

 #define f first
 #define s second
 #define pb push_back

using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

bool prime (int x)
{
for(int i=2;i*i<=x;i++)
{
    if(x%i==0){return false;}
}
return true;
}

int main ()
{
    ios::sync_with_stdio(0);
cin.tie(0);

int n;
int m;
cin>>n>>m;
vector<int> v(n);
vector<int>v2(n);
map<int,int> mapa;
for(int i=0;i<n;i++)
{
    cin>>v[i];
    mapa[i+1]=v[i];
    v2[i]=v[i];
}
for(int i=0;i<m;i++)
{
    int l;
    int r;
    int x;
    cin>>l>>r>>x;
   for (int j=l-1;j<r/2;j++)
   {
       int aux=v[i];
       v[i]=v[i+(r/2)];
       v[i+(r/2)]=aux;
          }
    if(v[x-1]==mapa[x]){cout<<"Yes"<<endl;}
    else{cout<<"No"<<endl;}

for(int j=0;j<n;j++)
{
    v[j]=v2[j];
}

}
return 0;

}


#include<bits/stdc++.h>

 #define f first
 #define s second
 #define pb push_back

using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

bool prime (int x)
{
for(int i=2;i*i<=x;i++)
{
    if(x%i==0){return false;}
}
return true;
}

int main ()
{
    ios::sync_with_stdio(0);
cin.tie(0);

int n;
int m;
cin>>n>>m;
vector<int> v(n);
vector<int>v2(n);
map<int,int> mapa;
for(int i=0;i<n;i++)
{
    cin>>v[i];
    mapa[i+1]=v[i];
    v2[i]=v[i];
}
for(int i=0;i<m;i++)
{
    int l;
    int r;
    int x;
    cin>>l>>r>>x;
   sort(v.begin()+(l-1),v.begin()+(r));
    if(v[x-1]==mapa[x]){cout<<"YES"<<endl;}
    else{cout<<"NO"<<endl;}

for(int i=0;i<n;i++)
{

    v[i]=v2[i];
}
cout<<endl;
}
return 0;

}


#include<bits/stdc++.h>

 #define f first
 #define s second
 #define pb push_back

using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

bool prime (int x)
{
for(int i=2;i*i<=x;i++)
{
    if(x%i==0){return false;}
}
return true;
}

int main ()
{
    ios::sync_with_stdio(0);
cin.tie(0);

int n;
int m;
cin>>n>>m;
vector<int> v(n);
vector<int>v2(n);
map<int,int> mapa;
for(int i=0;i<n;i++)
{
    cin>>v[i];
    mapa[i+1]=v[i];
    v2[i]=v[i];
}
for(int i=0;i<m;i++)
{
    int l;
    int r;
    int x;
    cin>>l>>r>>x;
   sort(v.begin()+(l-1),v.begin()+(r));
    if(v[x-1]==mapa[x]){cout<<"Yes"<<endl;}
    else{cout<<"No"<<endl;}

for(int j=0;j<n;j++)
{
    v[j]=v2[j];
}

}
return 0;

}


#include<bits/stdc++.h>

 #define f first
 #define s second
 #define pb push_back

using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

bool prime (int x)
{
for(int i=2;i*i<=x;i++)
{
    if(x%i==0){return false;}
}
return true;
}

int main ()
{
    ios::sync_with_stdio(0);
cin.tie(0);

int n;
int m;
cin>>n>>m;
vector<int> v(n);
vector<int>v2(n);
map<int,int> mapa;
for(int i=0;i<n;i++)
{
    cin>>v[i];
    mapa[i+1]=v[i];
    v2[i]=v[i];
}
for(int i=0;i<m;i++)
{
    int l;
    int r;
    int x;
    cin>>l>>r>>x;
   sort(v.begin()+(l-1),v.begin()+(r));
    if(v[x-1]==mapa[x]){cout<<"Yes"<<endl;}
    else{cout<<"No"<<endl;}

for(int i=0;i<n;i++)
{
    v[i]=v2[i];
}

}
return 0;

}


#include<bits/stdc++.h>
using namespace std;
	long long int n,m;

bool sort_comp(vector<int> v,int l,int r,int x)
{
	int temp = v[x],cnt = 0;
	for(int i = l;i<=r;i++)
	{
		if (v[i] < temp)
			cnt++;
	}

			if (l+cnt == x)
				return true;
			else
				return false;
	/*	}
	else
		return false;
*/
}
int main()
{
	cin>>n>>m;

	vector<int>  a;

		a.push_back(0);
	for(int i = 1;i<=n;i++)
	{
		int temp;
		cin>>temp;
		a.push_back(temp);
	}

	while(m--)
	{
		int l,r,x;
		cin>>l>>r>>x;

		bool ans = sort_comp(a,l,r,x);
		if (ans)
			cout<<"Yes\n";
		else
			cout<<"No\n";
	}

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
	long long int n,m;

bool sort_comp(vector<int> v,int l,int r,int x)
{
	int temp = v[x];
			sort(v.begin()+l,v.begin()+r+1);
	/*		for(int i = l;i<=r;i++)
			{
				cout<<v[i]<<" ";
			}
			cout<<endl;
*/

			if (v[x] == temp)
				return true;
			else
				return false;
	/*	}
	else
		return false;
*/
}
int main()
{
	cin>>n>>m;

	vector<int>  a;

		a.push_back(0);
	for(int i = 1;i<=n;i++)
	{
		int temp;
		cin>>temp;
		a.push_back(temp);
	}

	while(m--)
	{
		int l,r,x;
		cin>>l>>r>>x;

		bool ans = sort_comp(a,l,r,x);
		if (ans)
			cout<<"YES\n";
		else
			cout<<"NO\n";
	}

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
	long long int n,m;

bool sort_comp(vector<int> v,int l,int r,int x)
{
	int temp = v[x];
			sort(v.begin()+l,v.begin()+r+1);
	/*		for(int i = l;i<=r;i++)
			{
				cout<<v[i]<<" ";
			}
			cout<<endl;
*/

			if (v[x] == temp)
				return true;
			else
				return false;
	/*	}
	else
		return false;
*/
}
int main()
{
	cin>>n>>m;

	vector<int>  a;

		a.push_back(0);
	for(int i = 1;i<=n;i++)
	{
		int temp;
		cin>>temp;
		a.push_back(temp);
	}

	while(m--)
	{
		int l,r,x;
		cin>>l>>r>>x;

		bool ans = sort_comp(a,l,r,x);
		if (ans)
			cout<<"Yes\n";
		else
			cout<<"No\n";
	}

	return 0;
}


#include<bits/stdc++.h>
	using namespace std;
	int a, b, res;
	int v[10010];
	int aux[10010];

	int main (){
		int num, seq;
		scanf("%d %d",&num, &seq);
		for(int i = 0 ; i<num ; i++){
			scanf("%d", &v[i]);
		}

		for(int i = 0 ; i<seq ; i++){
			scanf("%d %d %d", &a, &b, &res);
				a-=1;
				b-=1;
				res-=1;
			for(int j = 0 ; j < num ; j++)
				aux[j] = v[j];

			sort(aux+a, aux+b+1);

			printf("\n");

			if(aux[res] == v[res])
				printf("Yes");
			else
				printf("No");
		}
	}


#include <bits/stdc++.h>
using namespace std;

#define ll long long int
#define pii pair<int, int>
#define INF 0x3f3f3f3f
#define fi first
#define mp make_pair
#define se second
#define FI(n) for(int i = 0; i < n; i++)
#define FOR(i,a,n) for (int i=(a);i<(n);++i)
#define t cout << "TESTE" << endl
#define debug(x) if(on)cout << x << endl
#define on true
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define pb push_back
#define debugv(v) for(auto x : v)cout << x << endl;
#define MAXN 100100

int v[MAXN];

int main(){
    fastio;
    int n, m;
    cin >> n >> m;
    FI(n)
        cin >> v[i];

    FI(m){
        int l, r, x;
        cin >> l >> r >> x;

        if(x < l || x > r){
            cout << "Yes" << endl;
            continue;
        }

        int count = 0, aux = v[x-1];
        for(int i = l-1 ; i <= r-1 ; i++)
            if(aux > v[i])
                count++;

        if(l + count == x){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}


	#include<bits/stdc++.h>
	using namespace std;
	int a, b, res;
	int v[10010];
	int aux[10010];

	int main (){
		int num, seq;
		scanf("%d %d",&num, &seq);
		for(int i = 0 ; i<num ; i++){
			scanf("%d", &v[i]);
		}

		for(int i = 0 ; i<seq ; i++){
			scanf("%d %d %d", &a, &b, &res);
				a-=1;
				b-=1;
				res-=1;
			for(int j = 0 ; j < num ; j++)
				aux[j] = v[j];

			sort(aux+a, aux+b+1);

			printf("\n");

			if(aux[res] == v[res])
				printf("Yes");
			else
				printf("No");
		}
	}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int n , m ;
    cin >> n >> m ;
    int arr[n+5]{};
    for(int i = 0 ; i < n ; i++){
        cin >> arr[i];
    }
    while(m--){
        int l , r , x;
        cin >> l >> r >> x;
        l--,x--;
        int a[n+5]{};
        int b[n+5]{};
        for(int i = l-1 ; i <=r-1 ; i++){
            a[i] = arr[i];
            b[i] = arr[i];
        }
        sort(a+l,a+r);
        if(b[x] == a[x])
            cout << "Yes"<< "\n";
        else
            cout << "No" << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int n , m ;
    cin >> n >> m ;
    int arr[n+5]{};
    for(int i = 0 ; i < n ; i++){
        cin >> arr[i];
    }
    while(m--){
        int l , r , x;
        cin >> l >> r >> x;
        l--,x--;
        int des = arr[x];
        int counte = 0 ;
        for(int i = l ; i <=r-1 ; i++){
            if(arr[i] < des)
                counte++;
        }
        int after = l + counte ;
        if(after == x)
            cout << "Yes"<< "\n";
        else
            cout << "No" << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int n , m ;
    cin >> n >> m ;
    int arr[n+5]{};
    for(int i = 0 ; i < n ; i++){
        cin >> arr[i];
    }
    while(m--){
        int l , r , x;
        cin >> l >> r >> x;
        l--,x--;
        int a[n+5]{};
        for(int i = 0 ; i < n ; i++){
            a[i] = arr[i];
        }
        sort(a+l,a+r);
        if(arr[x] == a[x])
            cout << "Yes"<< "\n";
        else
            cout << "No" << "\n";
    }
    return 0;
}


#define MAX 1000000+9   //Maximum array size
#include<bits/stdc++.h>
using namespace std;

int main()
{
   int n,m,arr[10009];
   cin>>n>>m;
   for(int i=1;i<=n;i++)cin>>arr[i];
   for(int i=0;i<m;i++){
     int l,r,x,sirch=0,arrrr[10009],ans=0;
     cin>>l>>r>>x;
     sirch=arr[x];
     for(int j=1;j<=n;j++){
        arrrr[j]=arr[j];
     }
    sort(arrrr+l,arrrr+r+1);
    if(arrrr[x]==sirch)cout<<"YES"<<endl;
    else
    cout<<"NO"<<endl;

   }
}


#define MAX 1000000+9   //Maximum array size
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,m,arr[10009];
    cin>>n>>m;
    for(int i=1; i<=n; i++)
        cin>>arr[i];
    for(int i=0; i<m; i++)
    {
        int l,r,x,sirch=0,ans=0;
        cin>>l>>r>>x;
        sirch=arr[x];
        for(int j=l; j<=r; j++)
        {
            if(sirch>arr[j])
                ans++;
        }
        if(ans+l==x)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }

}


#define MAX 1000000+9   //Maximum array size
#include<bits/stdc++.h>
using namespace std;

int main()
{
   int n,m,arr[10009];
   cin>>n>>m;
   for(int i=1;i<=n;i++)cin>>arr[i];
   for(int i=0;i<m;i++){
     int l,r,x,sirch=0,arrrr[10009],ans=0;
     cin>>l>>r>>x;
     sirch=arr[x];
     for(int j=1;j<=n;j++){
        arrrr[j]=arr[j];
     }
    sort(arrrr+l,arrrr+r+1);
    if(arrrr[x]==sirch)cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;

   }
}


#include <iostream>
#include <string>
#include <algorithm>
#include <array>

using namespace std;

int n,h,k,j,l,t,c;
int a[10010];
string s[10010];

int main() {
    cin >> n >> l;
    for (int i=1; i<=n; i++ ) {
        cin >> a[i];
    }
    for (int i=1; i<=l; i++ ) {
        c = 0;
        cin >> h >> k >> t;
        for (int j=h; j<=k; j++)
            if(a[j] < a[t]) c++;
        if(c+h == t) s[i] = "Yes";
        else s[i] = "No";
    }
    for (int i=1; i<=l; i++)
        cout << s[i] << endl;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <array>

using namespace std;

int n,h,k,j,l,t;
int a[1010];
int b[1010];
string s[1010];

void recode() {
    for (int j=1; j<=n; j++) {
        b[j] = a[j];
    }
}

int main() {
    cin >> n >> l;
    for (int i =1; i<=n; i++ ) {
        cin >> a[i];
    }
    for (int i =1; i<=l; i++) {
        recode();
        cin >> h >> k >> t;
        sort(b+h,b+k+1);
        if(a[t]==b[t]) s[i] ="Yes";
        else s[i] ="No";
    }
    for (int i=1; i<=l; i++) {
        cout << s[i] << endl;
    }

}


#include <iostream>
#include <string>
#include <algorithm>
#include <array>

using namespace std;

int n,h,k,j,l,t,c;
int a[10010];
string s[10010];

int main() {
    cin >> n >> l;
    for (int i=1; i<=n; i++ ) {
        cin >> a[i];
    }
    for (int i=1; i<=l; i++ ) {
        c = 0;
        cin >> h >> k >> t;
        for (int j=h; j<=k; j++)
            if(a[j] < a[t]) c++;
        if(c+h == t) s[i] = "YES";
        else s[i] = "NO";
    }
    for (int i=1; i<=l; i++)
        cout << s[i] << endl;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <array>

using namespace std;

int n,h,k,j,l,t;
int a[10010];
int b[10010];
string s[10010];

void recode() {
    for (int j=1; j<=n; j++) {
        b[j] = a[j];
    }
}

int main() {
    cin >> n >> l;
    for (int i =1; i<=n; i++ ) {
        cin >> a[i];
    }
    for (int i =1; i<=l; i++) {
        recode();
        cin >> h >> k >> t;
        sort(b+h,b+k+1);
        if(a[t]==b[t]) s[i] ="Yes";
        else s[i] ="No";
    }
    for (int i=1; i<=l; i++) {
        cout << s[i] << endl;
    }

}


#include <iostream>
#include <string>
#include <algorithm>
#include <array>

using namespace std;

int n,h,k,j,l,t;
int a[1010];
int b[1010];
string s[1010];

void recode() {
    for (int j=1; j<=n; j++) {
        b[j] = a[j];
    }
}

int main() {
    cin >> n >> l;
    for (int i =1; i<=n; i++ ) {
        cin >> a[i];
    }
    for (int i =1; i<=l; i++) {
        recode();
        cin >> h >> k >> t;
        sort(b+h,b+k+1);
        if(a[t]==b[t]) s[i] ="YES";
        else s[i] ="NO";
    }
    for (int i=1; i<=l; i++) {
        cout << s[i] << endl;
    }

}


/*   Author : S7a2a7d   */
#include <bits/stdc++.h>

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

using namespace std;

#define fast_io ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define pb push_back
#define ll long long
#define rep(i,n)  for(ll i=0;i<n;i++)
#define repi(i,n)  for(ll i=1;i<=n;i++)
#define mem(arr,x) memset(arr,x,sizeof(arr))

typedef vector<ll> vi;
typedef vector<char> vc;

#define mp make_pair
#define ff first
#define ss second

const double PI = 3.1415926535897932;
const int mod = 1e9 + 7;
const int inf = 1e9 + 5;
int max(int a,int b)
{
        if(a<b)
        return b;
        return a;
}
int min(int a,int b)
{
        if(a<b)
        return a;
        return b;
}
int __gcd(int a, int b)
{
    if (b == 0)
        return a;
    return __gcd(b, a % b);
}

int main()
{
  fast_io;
  int T=1;
  //cin>>T;
 while(T--)
 {
   ll n,m;
   cin>>n>>m;
  ll int a[n+1];
   for(int i=1;i<=n;i++)
   cin>>a[i];
   ll l,r,x, count_of_less=0;
   for(int i=0;i<m;i++)
   {
    cin>>l>>r>>x;
     count_of_less=0;
    for(int j=l;j<=r;j++)
    {
       if(a[j]<a[x])
        count_of_less++;
    }
    if(l+count_of_less==x)
      cout<<"Yes"<<'\n';
    else
      cout<<"No"<<'\n';

   }

 }
  }


#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

      int n,m;
      cin>>n>>m;
      int a[n];
      for(int i=0;i<n;i++)
      cin>>a[i];
      for(int i=0;i<m;i++)
      {   int b[n],l,r,x;
		  for(int o=0;o<n;o++)
		  b[o]=a[o];
		  cin>>l>>r>>x;
		  sort(b+l-1,b+r);
/*for(int o=0;o<n;o++)
		  cout<<b[o]<<" ";*/
		  //cout<<b[x+1]<<" "<<a[x-1];
		  if(b[x-1]==a[x-1])
		  cout<<"YES"<<endl;
		  else
		  cout<<"NO"<<endl;
	  }

}


#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

      int n,m;
      cin>>n>>m;
      int a[n];
      for(int i=0;i<n;i++)
      cin>>a[i];
      for(int i=0;i<m;i++)
      {   int b[n],l,r,x;
		  for(int o=0;o<n;o++)
		  b[o]=a[o];
		  cin>>l>>r>>x;
		  sort(b+l-1,b+r);
		  /*for(int o=0;o<n;o++)
		  cout<<b[o]<<" ";*/
		  //cout<<b[x+1]<<" "<<a[x-1];
		  if(b[x-1]==a[x-1])
		  cout<<"Yes"<<endl;
		  else
		  cout<<"No"<<endl;
	  }

}


/*   Author : S7a2a7d   */
#include <bits/stdc++.h>

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

using namespace std;

#define fast_io ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define pb push_back
#define ll long long
#define rep(i,n)  for(ll i=0;i<n;i++)
#define repi(i,n)  for(ll i=1;i<=n;i++)
#define mem(arr,x) memset(arr,x,sizeof(arr))

typedef vector<ll> vi;
typedef vector<char> vc;

#define mp make_pair
#define ff first
#define ss second

const double PI = 3.1415926535897932;
const int mod = 1e9 + 7;
const int inf = 1e9 + 5;
int max(int a,int b)
{
        if(a<b)
        return b;
        return a;
}
int min(int a,int b)
{
        if(a<b)
        return a;
        return b;
}
int __gcd(int a, int b)
{
    if (b == 0)
        return a;
    return __gcd(b, a % b);
}

int main()
{
  fast_io;
  int T=1;
  //cin>>T;
 while(T--)
 {
   ll n,m;
   cin>>n>>m;
  ll int a[n+1];
   for(int i=1;i<=n;i++)
   cin>>a[i];
   ll l,r,x, count_of_less=0;
   for(int i=0;i<m;i++)
   {
    cin>>l>>r>>x;
     count_of_less=0;
    for(int j=l;j<=r;j++)
    {
       if(a[j]<a[x])
        count_of_less++;
    }
    if(l+count_of_less==x)
      cout<<"Yes"<<'\n';
    else
      cout<<"No"<<'\n';

   }
 }
  }


#include <bits/stdc++.h>

using namespace std;

#define all(a)          a.begin(), a.end()
#define allr(a)         a.rbegin(), a.rend()
#define F				first
#define S				second
#define pb              push_back
#define ll				long long
#define f(i, a, n)		for(int i=a; i<n; ++i)
#define find(a, b)		(find(a.begin(), a.end(), b) == a.end())
#define fast 			ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define watch(x) 		cout << (#x) << " is " << (x) << endl

int main () {
  	fast
  	int n, m;
  	cin >> n >> m;
  	vector<int> input(n);
  	for(int i=1; i<=n; ++i) {
  		cin >> input[i];
  	}
  	for(int i=0; i<m; ++i) {
  		int l, r, x;
  		cin >> l >> r >> x;
  		bool sorted = true;
  		for(int j=l+1; j<=r; ++j) {
  			if(input[j-1] > input[j]) {
  				sorted = false;
  				break;
  			}
  		}
  		if(sorted) {
  			cout << "Yes\n";
  		} else {
  			int maxx = -1;
  			for(int j=l; j<=r; ++j) {
  				maxx = max(maxx, input[j]);
  			}
  			if(input[x] == x && maxx == r) {
  				cout << "Yes\n";
  			} else {
  				cout << "No\n";
  			}
  		}

  	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define all(a)          a.begin(), a.end()
#define allr(a)         a.rbegin(), a.rend()
#define F				first
#define S				second
#define pb              push_back
#define ll				long long
#define f(i, a, n)		for(int i=a; i<n; ++i)
#define find(a, b)		(find(a.begin(), a.end(), b) == a.end())
#define fast 			ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define watch(x) 		cout << (#x) << " is " << (x) << endl

int main () {
  	fast
  	int n, m;
  	cin >> n >> m;
  	vector<int> input(n);
  	for(int i=1; i<=n; ++i) {
  		cin >> input[i];
  	}
  	for(int i=0; i<m; ++i) {
  		int l, r, x;
  		cin >> l >> r >> x;
  		bool sorted = true;
  		for(int j=l+1; j<=r; ++j) {
  			if(input[j-1] > input[j]) {
  				sorted = false;
  				break;
  			}
  		}
  		if(sorted) {
  			cout << "YES\n";
  		} else {
  			int maxx = -1;
  			for(int j=l; j<=r; ++j) {
  				maxx = max(maxx, input[j]);
  			}
  			if(input[x] == x && maxx == r) {
  				cout << "YES\n";
  			} else {
  				cout << "NO\n";
  			}
  		}

  	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define all(a)          a.begin(), a.end()
#define allr(a)         a.rbegin(), a.rend()
#define F				first
#define S				second
#define pb              push_back
#define ll				long long
#define f(i, a, n)		for(int i=a; i<n; ++i)
#define find(a, b)		(find(a.begin(), a.end(), b) == a.end())
#define fast 			ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define watch(x) 		cout << (#x) << " is " << (x) << endl

int main () {
  	fast
  	int n, m;
  	cin >> n >> m;
  	vector<int> input(n+1);
  	for(int i=1; i<=n; ++i) {
  		cin >> input[i];
  	}
  	for(int i=0; i<m; ++i) {
  		int l, r, x;
  		cin >> l >> r >> x;
  		int pos = 0;
  		for(int j=l; j<=r; ++j) {
  			if(input[x] > input[j]) {
  				++pos;
  			}
  		}
  		if(l + pos == x) {
  			cout << "Yes\n";
  		} else {
  			cout << "No\n";
  		}
  	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define all(a)          a.begin(), a.end()
#define allr(a)         a.rbegin(), a.rend()
#define F				first
#define S				second
#define pb              push_back
#define ll				long long
#define f(i, a, n)		for(int i=a; i<n; ++i)
#define find(a, b)		(find(a.begin(), a.end(), b) == a.end())
#define fast 			ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define watch(x) 		cout << (#x) << " is " << (x) << endl

int main () {
  	fast
  	int n, m;
  	cin >> n >> m;
  	vector<int> input(n);
  	for(int i=1; i<=n; ++i) {
  		cin >> input[i];
  	}
  	for(int i=0; i<m; ++i) {
  		int l, r, x;
  		cin >> l >> r >> x;
  		int pos = 0;
  		for(int j=l; j<=r; ++j) {
  			if(input[x] > input[j]) {
  				++pos;
  			}
  		}
  		if(l + pos == x) {
  			cout << "Yes\n";
  		} else {
  			cout << "No\n";
  		}
  	}
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <conio.h>
#include <cmath>
#include <string>
using namespace std;

int main()
{
	int n, m,a,l,r,x,cnt;
	vector<int> p;
	vector<string> s;
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> a;
		p.push_back(a);
	}
	for (int i = 1; i <= m; ++i) {
		cin >> l >> r >> x;
		for (int j = l - 1; j < r; ++i) {
			if (p[j] < p[x - 1]) ++cnt;
			}
		if (x == l + cnt) s.push_back("Yes"); else s.push_back("No");
	}
	for (int i = 0; i < m; ++i) cout << s[i] << endl;
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <conio.h>
#include <cmath>
#include <string>
using namespace std;
int main()
{
	int n, m,a,l,r,x;
	vector<int> p;
	vector<string> s;
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> a;
		p.push_back(a);
	}
	for (int i = 1; i <= m; ++i) {
		cin >> l >> r >> x;
		if (p[x - 1] != x + l - 1)  s.push_back("No"); else s.push_back("Yes")
	}
	for (int i = 0; i < m; ++i) cout << s[i] << endl;
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <conio.h>
#include <cmath>
#include <string>
using namespace std;
int main()
{
	int n, m,a,l,r,x,c;
	vector<int> p,p2;
	vector<string> s;
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> a;
		p.push_back(a);
	}
	for (int i = 1; i <= m; ++i) {
		cin >> l >> r >> x;
			p2 = p;
			c = p2[x - 1];
			sort(p2.begin() + l - 1, p2.end() - (n - r));
			if (p2[x - 1] == c) s.push_back("Yes"); else s.push_back("No");
			p2.clear();
	}
	for (int i = 0; i < m; ++i) cout << s[i] << endl;
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <conio.h>
#include <cmath>
#include <string>
using namespace std;

int main()
{
	int n, m,a,l,r,x,cnt;
	vector<int> p;
	vector<string> s;
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> a;
		p.push_back(a);
	}
	for (int i = 1; i <= m; ++i) {
		cin >> l >> r >> x;
		for (int j = l - 1; j < r; ++j) {
			if (p[j] < p[x - 1]) ++cnt;
			}
		if (x == l + cnt) s.push_back("Yes"); else s.push_back("No");
	}
	for (int i = 0; i < m; ++i) cout << s[i] << endl;
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <conio.h>
#include <cmath>
#include <string>
using namespace std;

int main()
{
	int n, m,a,l,r,x,cnt;
	cnt = 0;
	vector<int> p;
	vector<string> s;
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> a;
		p.push_back(a);
	}
	for (int i = 1; i <= m; ++i) {
		cin >> l >> r >> x;
		for (int j = l - 1; j < r; ++j) {
			if (p[j] < p[x - 1]) ++cnt;
			}
		if (x == (l + cnt)) s.push_back("Yes"); else s.push_back("No");
		cnt = 0;
	}
	for (int i = 0; i < m; ++i) cout << s[i] << endl;
	return 0;
}


#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
	int n, m,a,l,r,x;
	vector<int> p;
	vector<string> s;
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> a;
		p.push_back(a);
	}
	for (int i = 1; i <= m; ++i) {
		cin >> l >> r >> x;
		if (p[x - 1] != x + l - 1)  s.push_back("No"); else s.push_back("Yes");
	}
	for (int i = 0; i < m; ++i) cout << s[i] << endl;
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <conio.h>
#include <cmath>
#include <string>
using namespace std;
int main()
{
	int n, m,a,l,r,x,c;
	vector<int> p,p2;
	vector<string> s;
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> a;
		p.push_back(a);
	}
	for (int i = 1; i <= m; ++i) {
		cin >> l >> r >> x;
			p2 = p;
			c = p2[x - 1];
			sort(p2.begin() + l - 1, p2.end() - (n - r));
			if (p2[x - 1] == c) s.push_back("Yes"); else s.push_back("No");
			p2.clear();
	}
	for (int i = 0; i < m; ++i) cout << s[i] << endl;
	system("pause");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef int ll;
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define ff first
#define ss second
#define pll pair<ll,ll>
#define mod 1000000007
#define pb push_back
#define ld long double
#define FIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
vector<ll> tree[40005],a(10005);
void build(ll x,ll l,ll r)
{
    if(l==r)
    {
        tree[x].pb(a[l]);
    }
    else
    {
        ll mid = (l + r)/2;
        build(2*x,l,mid);
        build(2*x+1,mid+1,r);
        merge(all(tree[2*x]) , all(tree[2*x + 1]) , back_inserter(tree[x]));
    }
}
ll query(ll x , ll start , ll end , ll l , ll r , ll val)
{
    if(start>end || start>r || end<l) return 0;
    if(start>=l && end<=r)
    {
        if(tree[x].size()==0 || val == tree[x][0]) return 0;
        return (lower_bound(all(tree[x]),val) - tree[x].begin());
    }
    ll mid = (start + end)/2;
    return query(2*x,start,mid,l,r,val) + query(2*x+1,mid+1,end,l,r,val);
}
int main()
{
	FIO;
    ll n,m;
    cin>>n>>m;
    for(ll i=0;i<n;i++) cin>>a[i];
    build(1,0,n-1);
    while(m--)
    {
        ll l,r,x;
        cin>>l>>r>>x;
        x--;
        l--;
        r--;
        ll small = query(1,0,n-1,l,r,a[x]);
        //cout<<small<<endl;
        if(small==(x-l)) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef int ll;
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define ff first
#define ss second
#define pll pair<ll,ll>
#define mod 1000000007
#define pb push_back
#define ld long double
#define FIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll pre[10001][10001];

int main()
{
	FIO;
    ll n,m;
    cin>>n>>m;
    ll a[n];
    for(ll i=0;i<n;i++) cin>>a[i];
    for(ll i=0;i<n;i++)
    {
        ll cnt = 0;
        for(ll j=i+1;j<n;j++)
        {
            if(a[j] < a[i]) cnt++;
            pre[i][j] = cnt;
        }
        cnt = 0;
        for(ll j=i-1;j>=0;j--)
        {
            if(a[j] < a[i]) cnt++;
            pre[i][j] = cnt;
        }
    }
    while(m--)
    {
        ll l,r,x;
        cin>>l>>r>>x;
        x--;
        l--;
        r--;
        ll small = pre[x][l] + pre[x][r];
        if(small==(x-l)) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define ff first
#define ss second
#define pll pair<ll,ll>
#define mod 1000000007
#define pb push_back
#define ld long double
#define FIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll pre[10001][10001];
void solve()
{
    ll n,m;
    cin>>n>>m;
    ll a[n];
    for(ll i=0;i<n;i++) cin>>a[i];
    for(ll i=0;i<n;i++)
    {
        ll cnt = 0;
        for(ll j=i+1;j<n;j++)
        {
            if(a[j] < a[i]) cnt++;
            pre[i][j] = cnt;
        }
        cnt = 0;
        for(ll j=i-1;j>=0;j--)
        {
            if(a[j] < a[i]) cnt++;
            pre[i][j] = cnt;
        }
    }
    while(m--)
    {
        ll l,r,x;
        cin>>l>>r>>x;
        x--;
        l--;
        r--;
        ll small = pre[x][l] + pre[x][r];
        if(small==(x-l)) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}

int main()
{
	FIO;
	ll t=1;
	//cin>>t;
	while(t--) solve();
}


// Bismillahir Rahmanir Rahim .Ya Allah...
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;
typedef pair<int,int> PII;
const int mod = 1e9+7,INF = 1e9;
const int mx = 1e6+5;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    vector<int>a(n+5),b(n+5);
    for(int i=1;i<=n;i++)
        cin>>a[i];
    while(m--)
    {
        b= a;
        int l,r,d;
        cin>>l>>r>>d;
        sort(b.begin()+l,b.begin()+r+1);
        //for(int i=1;i<=n;i++)
           // cout<<b[i]<<" ";
        if(b[d]==a[d])
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;

    }

    return 0;
}


// Bismillahir Rahmanir Rahim .Ya Allah...
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;
typedef pair<int,int> PII;
const int mod = 1e9+7,INF = 1e9;
const int mx = 1e6+5;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    vector<int>a(n+5),b(n+5);
    for(int i=1;i<=n;i++)
        cin>>a[i];
    while(m--)
    {
        int l,r,d,c=0;
        cin>>l>>r>>d;
        for(int i=l;i<=r;i++)
            if(a[i]<a[d])
                c++;
        if(a[l+c]==a[d])
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;

    }

    return 0;
}


// Bismillahir Rahmanir Rahim .Ya Allah...
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;
typedef pair<int,int> PII;
const int mod = 1e9+7,INF = 1e9;
const int mx = 1e6+5;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    vector<int>a(n+5),b(n+5);
    for(int i=1;i<=n;i++)
        cin>>a[i];
    while(m--)
    {
        b= a;
        int l,r,d;
        cin>>l>>r>>d;
        sort(b.begin()+l,b.begin()+r+1);
        //for(int i=1;i<=n;i++)
           // cout<<b[i]<<" ";
        if(b[d]==a[d])
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;

    }

    return 0;
}


#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20);
    int n, m; cin >> n >> m;
    vector<int> p(n);
    for (int &x : p) {
        cin >> x;
    }
    for (int i = 0; i < m; i++) {
        auto v = p;
        int l, r, x; cin >> l >> r >> x;
        l--, r--, x--;
        vector<bool> have(n + 10, false);
        for (int j = l; j <= r; j++) {
            have[p[j]] = true;
        }
        int ptr = l;
        for (int i = 1; i <= n; i++) {
            if (have[i]) {
                v[ptr++] = i;
            }
        }
        cout << (v[x] == p[x] ? "Yes" : "No") << "\n";
    }
}


#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20);
    int n, m; cin >> n >> m;
    vector<int> p(n);
    for (int &x : p) {
        cin >> x;
    }
    for (int i = 0; i < m; i++) {
        auto v = p;
        int l, r, x; cin >> l >> r >> x;
        l--, r--, x--;
        sort(v.begin() + l, v.begin() + r + 1);
        cout << (v[x] == p[x] ? "Yes" : "No") << "\n";
    }
}


#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.setf(ios::fixed); cout.precision(20);
    int n, m; cin >> n >> m;
    vector<int> p(n);
    for (int &x : p) {
        cin >> x;
    }
    for (int i = 0; i < m; i++) {
        auto v = p;
        int l, r, x; cin >> l >> r >> x;
        l--, r--, x--;
        vector<bool> have(n + 10, false);
        for (int j = l; j <= r; j++) {
            have[p[j]] = true;
        }
        int ptr = l;
        for (int j = 1; j <= n; j++) {
            if (have[j]) {
                v[ptr++] = j;
            }
        }
        cout << (v[x] == p[x] ? "Yes" : "No") << "\n";
    }
}


/*___________Bismillahir Rahmanir Rahim__________*/
//Think positive, be positive and never use negative words
#include<bits/stdc++.h>
#define ll               long long int
#define uni(a)           a.erase(unique(a.begin(),a.end()),a.end())
#define vsum(a)          accumulate(a.begin(),a.end(),0)
#define vmax(a)          *max_element(a.begin(),a.end())
#define vmin(a)          *min_element(a.begin(),a.end())
#define gcd(a,b)         __gcd(a,b)
#define lcm(a,b)         (a/gcd(a,b))*b
#define yes              cout<<"YES"<<endl
#define no               cout<<"NO"<<endl
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n, m;
    cin>>n>>m;
    ll i, a[n];
    vector<ll>v;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        v.push_back(a[i]);
    }
    ll l, r, x;
    while(m--)
    {
        cin>>l>>r>>x;
        ll before=v[x-1];
        ll j=0, b[r-l+1];
        for(i=l-1; i<r; i++)
        {
            b[j]=v[i];
            j++;
        }
        sort(b,b+(r-l+1));

        j=0;
        for(i=l-1; i<r; i++)
        {
            v[i]=b[j];
            j++;
        }
        //for(i=0; i<v.size(); i++) cout<<v[i]<<" ";
        //cout<<endl;
        if(v[x-1]==before) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
        for(i=0; i<n; i++)
        {
            v[i]=a[i];
        }
    }
    return 0;
}
/*_________________Alhamdulillah_________________*/


/*___________Bismillahir Rahmanir Rahim__________*/
//Think positive, be positive and never use negative words
#include<bits/stdc++.h>
#define ll               long long int
#define uni(a)           a.erase(unique(a.begin(),a.end()),a.end())
#define vsum(a)          accumulate(a.begin(),a.end(),0)
#define vmax(a)          *max_element(a.begin(),a.end())
#define vmin(a)          *min_element(a.begin(),a.end())
#define gcd(a,b)         __gcd(a,b)
#define lcm(a,b)         (a/gcd(a,b))*b
#define yes              cout<<"YES"<<endl
#define no               cout<<"NO"<<endl
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n, m;
    cin>>n>>m;
    ll i, a[n];
    vector<ll>v;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        v.push_back(a[i]);
    }
    ll j, l, r, x;
    while(m--)
    {
        cin>>l>>r>>x;
        ll before=v[x-1];
        for(i=l-1; i<r; i++)
        {
            for(j=i+1; j<r; j++)
            {
                if(v[i]>v[j])
                {
                    swap(v[i],v[j]);
                }
            }
        }
        //for(i=0; i<v.size(); i++) cout<<v[i]<<" ";
        //cout<<endl;
        if(v[x-1]==before) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
        for(i=0; i<n; i++)
        {
            v[i]=a[i];
        }
    }
    return 0;
}
/*_________________Alhamdulillah_________________*/


/*___________Bismillahir Rahmanir Rahim__________*/
//Think positive, be positive and never use negative words
#include<bits/stdc++.h>
#define ll               long long int
#define uni(a)           a.erase(unique(a.begin(),a.end()),a.end())
#define vsum(a)          accumulate(a.begin(),a.end(),0)
#define vmax(a)          *max_element(a.begin(),a.end())
#define vmin(a)          *min_element(a.begin(),a.end())
#define gcd(a,b)         __gcd(a,b)
#define lcm(a,b)         (a/gcd(a,b))*b
#define yes              cout<<"YES"<<endl
#define no               cout<<"NO"<<endl
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n, m;
    cin>>n>>m;
    ll i, a[n];
    vector<ll>v, ron;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        v.push_back(a[i]);
    }
    ll l, r, x;
    while(m--)
    {
        cin>>l>>r>>x;
        ll before=v[x-1];
        ll element=0;
        for(i=l-1; i<r; i++)
        {
            element+=(a[i]<before);
        }
        ll index=l+element;

        if(index==x) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    return 0;
}
/*_________________Alhamdulillah_________________*/


/*___________Bismillahir Rahmanir Rahim__________*/
//Think positive, be positive and never use negative words
#include<bits/stdc++.h>
#define ll               long long int
#define uni(a)           a.erase(unique(a.begin(),a.end()),a.end())
#define vsum(a)          accumulate(a.begin(),a.end(),0)
#define vmax(a)          *max_element(a.begin(),a.end())
#define vmin(a)          *min_element(a.begin(),a.end())
#define gcd(a,b)         __gcd(a,b)
#define lcm(a,b)         (a/gcd(a,b))*b
#define yes              cout<<"YES"<<endl
#define no               cout<<"NO"<<endl
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n, m;
    cin>>n>>m;
    ll i, a[n];
    vector<ll>v, ron;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        v.push_back(a[i]);
    }
    ll l, r, x;
    while(m--)
    {
        cin>>l>>r>>x;
        ll before=v[x-1];
        ll element=0;
        for(i=l-1; i<r; i++)
        {
            element+=(a[i]<before);
        }
        ll index=l+element;

        if(index==x) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}
/*_________________Alhamdulillah_________________*/


/*___________Bismillahir Rahmanir Rahim__________*/
//Think positive, be positive and never use negative words
#include<bits/stdc++.h>
#define ll               long long int
#define uni(a)           a.erase(unique(a.begin(),a.end()),a.end())
#define vsum(a)          accumulate(a.begin(),a.end(),0)
#define vmax(a)          *max_element(a.begin(),a.end())
#define vmin(a)          *min_element(a.begin(),a.end())
#define gcd(a,b)         __gcd(a,b)
#define lcm(a,b)         (a/gcd(a,b))*b
#define yes              cout<<"YES"<<endl
#define no               cout<<"NO"<<endl
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n, m;
    cin>>n>>m;
    ll i, a[n];
    vector<ll>v;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
        v.push_back(a[i]);
    }
    ll j, l, r, x;
    while(m--)
    {
        cin>>l>>r>>x;
        ll before=v[x-1];
        for(i=l-1; i<r; i++)
        {
            for(j=i+1; j<r; j++)
            {
                if(v[i]>v[j])
                {
                    swap(v[i],v[j]);
                }
            }
        }
        //for(i=0; i<v.size(); i++) cout<<v[i]<<" ";
        //cout<<endl;
        if(v[x-1]==before) yes;
        else no;
        for(i=0; i<n; i++)
        {
            v[i]=a[i];
        }
    }
    return 0;
}
/*_________________Alhamdulillah_________________*/


#include <bits/stdc++.h>

using namespace std;
#define ll long long

int main()
{
  int n,m;
  map<int,int>nn;
  std::vector<int>v,v1 ;
  scanf("%d%d",&n,&m);
  int p[n];
  for(int i=0 ;i<n ;++i){
      scanf("%d",&p[i]);
      nn[i]=p[i];
      v.push_back(p[i]);
  }
  while(m--){
      int l,r,x;
      scanf("%d%d%d",&l,&r,&x);
      v1=v;
      sort(v1.begin()+l-1,v1.end()-(v1.size()-r));
     v1[x-1]==nn[x-1]?printf("Yes\n"):printf("No\n");
  }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define ll long long

int main()
{
  int n,m;

  scanf("%d%d",&n,&m);
  int p[n],ind[n],ans[n];
  for(int i=1 ;i<=n ;++i){
      scanf("%d",&p[i]);
     ind[p[i]]=i;
  }
  while(m--){
      int l,r,x,k;
      scanf("%d%d%d",&l,&r,&x);
      k=l;
      for(int i=1;i<=n;++i){
          if(ind[i]>=l&& ind[i]<=r){
              ans[k]=i;
              k++;
          }
          if(k>r)break;
      }
     ans[x]==p[x]?printf("Yes\n"):printf("No\n");
  }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define ll long long

int main()
{
  int n,m;
  map<int,int>nn;
  std::vector<int>v,v1 ;
  scanf("%d%d",&n,&m);
  int p[n];
  for(int i=0 ;i<n ;++i){
      scanf("%d",&p[i]);
      nn[i]=p[i];
      v.push_back(p[i]);
  }
  while(m--){
      int l,r,x;
      scanf("%d%d%d",&l,&r,&x);
      v1=v;
      sort(v1.begin()+l-1,v1.end()-(v1.size()-r));
     v1[x-1]==nn[x-1]?printf("YES\n"):printf("NO\n");
  }
    return 0;
}


using namespace std;
#define ll long long

int main()
{
  int n,m;
  map<int,int>nn;
  std::vector<int>v,v1 ;
  scanf("%d%d",&n,&m);
  int p[n];
  for(int i=0 ;i<n ;++i){
      scanf("%d",&p[i]);
      nn[i]=p[i];
      v.push_back(p[i]);
  }
  while(m--){
      int l,r,x;
      scanf("%d%d%d",&l,&r,&x);
      v1=v;
      sort(v1.begin()+l-1,v1.end()-(v1.size()-r));
     v1[x-1]==nn[x-1]?printf("YES\n"):printf("NO\n");
  }
    return 0;
}


/*AUTHOR SAJAL HIT*/
#include<bits/stdc++.h>
#define ll long long int
#define pii pair<ll,ll>
#define mp make_pair
#define pb push_back
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define M 500005
#define mod 1000000007
#define inf LLONG_MAX
#define endl "\n"
#define MAX 100000
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
const ll maxn=1e5+2;
//const ll mod=3e18;
using namespace std;
bool isPrime(ll n){
	if(n<=1)
		return false;
	if(n<=3)
		return true;
	if(n%2==0 || n%3==0)
		return false;
	for(ll i=5;i*i<=n;i++){
		if(n%i==0 || n%(i+2)==0)
			return false;
	}
	return true;
}
bool cmp(pair<int,int> p,pair<int,int> q){
	if(p.second==q.second){
		return p.first>q.first;
	}else{
		return p.second>q.second;
	}
}
ll lcmN(int a,int b){
	ll large=max(a,b);
	ll small=min(a,b);
	for(ll i=large;;i+=large){
		if(i%small==0){
			return i;
		}
	}
}
int findX(int A, int B) //smallest x A^x +b^x
{
    int j = 0, x = 0;
    while (A || B) {
        if ((A & 1) && (B & 1)) {
            x += (1 << j);
        }
        A >>= 1;
        B >>= 1;
        j += 1;
    }
    return x;
}
//inversion count
unsigned long long int merge(int a[],int t[],int l,int m,int r){
	unsigned long long int ic=0;
	int i,j,k;
	i=l,j=m,k=l;
	while((i<=m)&&(j<=r)){
		if(a[i]<=a[j]){
			t[k++]=a[i++];
		}else{
			t[k++]=a[j++];
			ic=ic+(m-i);
		}
	}
	while(i<=m-1){
		t[k++]=a[i++];
	}
	while(j<=r){
		t[k++]=a[j++];
	}
	for(i=l;i<=r;i++){
		a[i]=t[i];
	}
	return ic;
}
unsigned long long int _mergesort(int a[],int t[],int l,int r){
	int m;
	unsigned long long int ic=0;
	if(r>l){
		m=(l+r)/2;
		ic+=_mergesort(a,t,l,m);
		ic+=_mergesort(a,t,m+1,r);
		ic+=merge(a,t,l,m+1,r);
	}
	return ic;
}
unsigned long long int mergesort(int a[],int s){
	int t[s];
	return _mergesort(a,t,0,s-1);
}
//kth divisible by n smallest
vector<ll> s;
void f(ll n){
	for(ll i=1;i*i<=n;i++){
		if(n%i==0){
			s.push_back(i);
			if((n/i)!=i){
				s.push_back(n/i);
			}
		}
	}
}
//kth not divisible by n
void g(){
	ll n,k;
	cin>>n>>k;
	ll ks=k-(n-1);
	if(k<n){
		cout<<k;
	}else if(ks%(n-1)==0){
		cout<<(ks/(n-1)+1)*n-1;
	}else{
		cout<<(ks/(n-1)+1)*n+ks%(n-1);
	}
	cout<<endl;
}
// divisor of a numner
void div(){
	ll b,k=0,i,j;
	cin>>b;
	double y=sqrt(b);
	double p=floor(y);
	for(i=1;i<=p;i++){
		j=b/i;
		if(i*j==b){
			k++;
		}
	}
	if(y==p){
		cout<<2*k-1;
	}else{
		cout<<2*k;
	}
}
//odd sum non intersecting segments
void odd_segment(){
	int n,k;
	cin>>n>>k;
	int a[n],odd=0,s=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	vector<int> ind;
	for(int i=0;i<n;i++){
		s+=a[i];
		if(k!=1 && s&1){
			ind.push_back(i+1);
			k--;
			s=0;
		}
	}
	if(k!=1 || (s%2==0)){
		cout<<"NO"<<endl;
	}else{
		cout<<"YES"<<endl;
		for(int it:ind){
			cout<<it<<" ";
		}
		cout<<n<<endl;
	}
}
//dfs
vector<int> gr[10001];
int sm=0;
int c[10001];
int v[10001];
void dfs(int x){
	v[x]=1;
	for(auto u:gr[x]){
		if(!v[u]){
			if(c[u]!=c[x]){
				sm++;
			}
			dfs(u);
		}
	}
}
int main()
{
	SPEED;
	int n,m;
	vector<int> a(n+1,0);
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	while(m--){
		int l,r,x;
		cin>>l>>r>>x;
		int c=0;
		for(int i=l;i<=r;i++){
			if(a[i]<x){
				c++;
			}
		}
		if(l+c==x){
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
	}
}


/*AUTHOR SAJAL HIT*/
#include<bits/stdc++.h>
#define ll long long int
#define pii pair<ll,ll>
#define mp make_pair
#define pb push_back
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define M 500005
#define mod 1000000007
#define inf LLONG_MAX
#define endl "\n"
#define MAX 100000
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
const ll maxn=1e5+2;
//const ll mod=3e18;
using namespace std;
bool isPrime(ll n){
	if(n<=1)
		return false;
	if(n<=3)
		return true;
	if(n%2==0 || n%3==0)
		return false;
	for(ll i=5;i*i<=n;i++){
		if(n%i==0 || n%(i+2)==0)
			return false;
	}
	return true;
}
bool cmp(pair<int,int> p,pair<int,int> q){
	if(p.second==q.second){
		return p.first>q.first;
	}else{
		return p.second>q.second;
	}
}
ll lcmN(int a,int b){
	ll large=max(a,b);
	ll small=min(a,b);
	for(ll i=large;;i+=large){
		if(i%small==0){
			return i;
		}
	}
}
int findX(int A, int B) //smallest x A^x +b^x
{
    int j = 0, x = 0;
    while (A || B) {
        if ((A & 1) && (B & 1)) {
            x += (1 << j);
        }
        A >>= 1;
        B >>= 1;
        j += 1;
    }
    return x;
}
//inversion count
unsigned long long int merge(int a[],int t[],int l,int m,int r){
	unsigned long long int ic=0;
	int i,j,k;
	i=l,j=m,k=l;
	while((i<=m)&&(j<=r)){
		if(a[i]<=a[j]){
			t[k++]=a[i++];
		}else{
			t[k++]=a[j++];
			ic=ic+(m-i);
		}
	}
	while(i<=m-1){
		t[k++]=a[i++];
	}
	while(j<=r){
		t[k++]=a[j++];
	}
	for(i=l;i<=r;i++){
		a[i]=t[i];
	}
	return ic;
}
unsigned long long int _mergesort(int a[],int t[],int l,int r){
	int m;
	unsigned long long int ic=0;
	if(r>l){
		m=(l+r)/2;
		ic+=_mergesort(a,t,l,m);
		ic+=_mergesort(a,t,m+1,r);
		ic+=merge(a,t,l,m+1,r);
	}
	return ic;
}
unsigned long long int mergesort(int a[],int s){
	int t[s];
	return _mergesort(a,t,0,s-1);
}
//kth divisible by n smallest
vector<ll> s;
void f(ll n){
	for(ll i=1;i*i<=n;i++){
		if(n%i==0){
			s.push_back(i);
			if((n/i)!=i){
				s.push_back(n/i);
			}
		}
	}
}
//kth not divisible by n
void g(){
	ll n,k;
	cin>>n>>k;
	ll ks=k-(n-1);
	if(k<n){
		cout<<k;
	}else if(ks%(n-1)==0){
		cout<<(ks/(n-1)+1)*n-1;
	}else{
		cout<<(ks/(n-1)+1)*n+ks%(n-1);
	}
	cout<<endl;
}
// divisor of a numner
void div(){
	ll b,k=0,i,j;
	cin>>b;
	double y=sqrt(b);
	double p=floor(y);
	for(i=1;i<=p;i++){
		j=b/i;
		if(i*j==b){
			k++;
		}
	}
	if(y==p){
		cout<<2*k-1;
	}else{
		cout<<2*k;
	}
}
//odd sum non intersecting segments
void odd_segment(){
	int n,k;
	cin>>n>>k;
	int a[n],odd=0,s=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	vector<int> ind;
	for(int i=0;i<n;i++){
		s+=a[i];
		if(k!=1 && s&1){
			ind.push_back(i+1);
			k--;
			s=0;
		}
	}
	if(k!=1 || (s%2==0)){
		cout<<"NO"<<endl;
	}else{
		cout<<"YES"<<endl;
		for(int it:ind){
			cout<<it<<" ";
		}
		cout<<n<<endl;
	}
}
//dfs
vector<int> gr[10001];
int sm=0;
int c[10001];
int v[10001];
void dfs(int x){
	v[x]=1;
	for(auto u:gr[x]){
		if(!v[u]){
			if(c[u]!=c[x]){
				sm++;
			}
			dfs(u);
		}
	}
}
int main()
{
	SPEED;
	int n,m;
	cin>>n>>m;
	vector<int> a(n+1,0);
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	while(m--){
		int l,r,x;
		cin>>l>>r>>x;
		int c=0;
		for(int i=l;i<=r;i++){
			if(a[i]<a[x]){
				c++;
			}
		}
		if(l+c==x){
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
	}
}


/*AUTHOR SAJAL HIT*/
#include<bits/stdc++.h>
#define ll long long int
#define pii pair<ll,ll>
#define mp make_pair
#define pb push_back
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define M 500005
#define mod 1000000007
#define inf LLONG_MAX
#define endl "\n"
#define MAX 100000
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
const ll maxn=1e5+2;
//const ll mod=3e18;
using namespace std;
bool isPrime(ll n){
	if(n<=1)
		return false;
	if(n<=3)
		return true;
	if(n%2==0 || n%3==0)
		return false;
	for(ll i=5;i*i<=n;i++){
		if(n%i==0 || n%(i+2)==0)
			return false;
	}
	return true;
}
bool cmp(pair<int,int> p,pair<int,int> q){
	if(p.second==q.second){
		return p.first>q.first;
	}else{
		return p.second>q.second;
	}
}
ll lcmN(int a,int b){
	ll large=max(a,b);
	ll small=min(a,b);
	for(ll i=large;;i+=large){
		if(i%small==0){
			return i;
		}
	}
}
int findX(int A, int B) //smallest x A^x +b^x
{
    int j = 0, x = 0;
    while (A || B) {
        if ((A & 1) && (B & 1)) {
            x += (1 << j);
        }
        A >>= 1;
        B >>= 1;
        j += 1;
    }
    return x;
}
//inversion count
unsigned long long int merge(int a[],int t[],int l,int m,int r){
	unsigned long long int ic=0;
	int i,j,k;
	i=l,j=m,k=l;
	while((i<=m)&&(j<=r)){
		if(a[i]<=a[j]){
			t[k++]=a[i++];
		}else{
			t[k++]=a[j++];
			ic=ic+(m-i);
		}
	}
	while(i<=m-1){
		t[k++]=a[i++];
	}
	while(j<=r){
		t[k++]=a[j++];
	}
	for(i=l;i<=r;i++){
		a[i]=t[i];
	}
	return ic;
}
unsigned long long int _mergesort(int a[],int t[],int l,int r){
	int m;
	unsigned long long int ic=0;
	if(r>l){
		m=(l+r)/2;
		ic+=_mergesort(a,t,l,m);
		ic+=_mergesort(a,t,m+1,r);
		ic+=merge(a,t,l,m+1,r);
	}
	return ic;
}
unsigned long long int mergesort(int a[],int s){
	int t[s];
	return _mergesort(a,t,0,s-1);
}
//kth divisible by n smallest
vector<ll> s;
void f(ll n){
	for(ll i=1;i*i<=n;i++){
		if(n%i==0){
			s.push_back(i);
			if((n/i)!=i){
				s.push_back(n/i);
			}
		}
	}
}
//kth not divisible by n
void g(){
	ll n,k;
	cin>>n>>k;
	ll ks=k-(n-1);
	if(k<n){
		cout<<k;
	}else if(ks%(n-1)==0){
		cout<<(ks/(n-1)+1)*n-1;
	}else{
		cout<<(ks/(n-1)+1)*n+ks%(n-1);
	}
	cout<<endl;
}
// divisor of a numner
void div(){
	ll b,k=0,i,j;
	cin>>b;
	double y=sqrt(b);
	double p=floor(y);
	for(i=1;i<=p;i++){
		j=b/i;
		if(i*j==b){
			k++;
		}
	}
	if(y==p){
		cout<<2*k-1;
	}else{
		cout<<2*k;
	}
}
//odd sum non intersecting segments
void odd_segment(){
	int n,k;
	cin>>n>>k;
	int a[n],odd=0,s=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	vector<int> ind;
	for(int i=0;i<n;i++){
		s+=a[i];
		if(k!=1 && s&1){
			ind.push_back(i+1);
			k--;
			s=0;
		}
	}
	if(k!=1 || (s%2==0)){
		cout<<"NO"<<endl;
	}else{
		cout<<"YES"<<endl;
		for(int it:ind){
			cout<<it<<" ";
		}
		cout<<n<<endl;
	}
}
//dfs
vector<int> gr[10001];
int sm=0;
int c[10001];
int v[10001];
void dfs(int x){
	v[x]=1;
	for(auto u:gr[x]){
		if(!v[u]){
			if(c[u]!=c[x]){
				sm++;
			}
			dfs(u);
		}
	}
}
int main()
{
	SPEED;
	int n,m;
	vecctor<int> a(n+1,0);
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	while(m--){
		int l,r,x;
		cin>>l>>r>>x;
		int c=0;
		for(int i=l;i<=r;i++){
			if(a[i]<x){
				c++;
			}
		}
		if(l+c==x){
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
	}
}


/*AUTHOR SAJAL HIT*/
#include<bits/stdc++.h>
#define ll long long int
#define pii pair<ll,ll>
#define mp make_pair
#define pb push_back
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define M 500005
#define mod 1000000007
#define inf LLONG_MAX
#define endl "\n"
#define MAX 100000
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
const ll maxn=1e5+2;
//const ll mod=3e18;
using namespace std;
bool isPrime(ll n){
	if(n<=1)
		return false;
	if(n<=3)
		return true;
	if(n%2==0 || n%3==0)
		return false;
	for(ll i=5;i*i<=n;i++){
		if(n%i==0 || n%(i+2)==0)
			return false;
	}
	return true;
}
bool cmp(pair<int,int> p,pair<int,int> q){
	if(p.second==q.second){
		return p.first>q.first;
	}else{
		return p.second>q.second;
	}
}
ll lcmN(int a,int b){
	ll large=max(a,b);
	ll small=min(a,b);
	for(ll i=large;;i+=large){
		if(i%small==0){
			return i;
		}
	}
}
int findX(int A, int B) //smallest x A^x +b^x
{
    int j = 0, x = 0;
    while (A || B) {
        if ((A & 1) && (B & 1)) {
            x += (1 << j);
        }
        A >>= 1;
        B >>= 1;
        j += 1;
    }
    return x;
}
//inversion count
unsigned long long int merge(int a[],int t[],int l,int m,int r){
	unsigned long long int ic=0;
	int i,j,k;
	i=l,j=m,k=l;
	while((i<=m)&&(j<=r)){
		if(a[i]<=a[j]){
			t[k++]=a[i++];
		}else{
			t[k++]=a[j++];
			ic=ic+(m-i);
		}
	}
	while(i<=m-1){
		t[k++]=a[i++];
	}
	while(j<=r){
		t[k++]=a[j++];
	}
	for(i=l;i<=r;i++){
		a[i]=t[i];
	}
	return ic;
}
unsigned long long int _mergesort(int a[],int t[],int l,int r){
	int m;
	unsigned long long int ic=0;
	if(r>l){
		m=(l+r)/2;
		ic+=_mergesort(a,t,l,m);
		ic+=_mergesort(a,t,m+1,r);
		ic+=merge(a,t,l,m+1,r);
	}
	return ic;
}
unsigned long long int mergesort(int a[],int s){
	int t[s];
	return _mergesort(a,t,0,s-1);
}
//kth divisible by n smallest
vector<ll> s;
void f(ll n){
	for(ll i=1;i*i<=n;i++){
		if(n%i==0){
			s.push_back(i);
			if((n/i)!=i){
				s.push_back(n/i);
			}
		}
	}
}
//kth not divisible by n
void g(){
	ll n,k;
	cin>>n>>k;
	ll ks=k-(n-1);
	if(k<n){
		cout<<k;
	}else if(ks%(n-1)==0){
		cout<<(ks/(n-1)+1)*n-1;
	}else{
		cout<<(ks/(n-1)+1)*n+ks%(n-1);
	}
	cout<<endl;
}
// divisor of a numner
void div(){
	ll b,k=0,i,j;
	cin>>b;
	double y=sqrt(b);
	double p=floor(y);
	for(i=1;i<=p;i++){
		j=b/i;
		if(i*j==b){
			k++;
		}
	}
	if(y==p){
		cout<<2*k-1;
	}else{
		cout<<2*k;
	}
}
//odd sum non intersecting segments
void odd_segment(){
	int n,k;
	cin>>n>>k;
	int a[n],odd=0,s=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	vector<int> ind;
	for(int i=0;i<n;i++){
		s+=a[i];
		if(k!=1 && s&1){
			ind.push_back(i+1);
			k--;
			s=0;
		}
	}
	if(k!=1 || (s%2==0)){
		cout<<"NO"<<endl;
	}else{
		cout<<"YES"<<endl;
		for(int it:ind){
			cout<<it<<" ";
		}
		cout<<n<<endl;
	}
}
//dfs
vector<int> gr[10001];
int sm=0;
int c[10001];
int v[10001];
void dfs(int x){
	v[x]=1;
	for(auto u:gr[x]){
		if(!v[u]){
			if(c[u]!=c[x]){
				sm++;
			}
			dfs(u);
		}
	}
}
int main()
{
	SPEED;
	int n,m;
	vector<int> a(n+1,0);
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	while(m--){
		int l,r,x;
		cin>>l>>r>>x;
		int c=0;
		for(int i=l;i<=r;i++){
			if(a[i]<a[x]){
				c++;
			}
		}
		if(l+c==x){
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
	}
}


/*input
6 5
1 4 3 2 5 6
2 4 3
1 6 2
4 5 4
1 3 3
2 6 3

*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll maxn=5e5+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=3.14159265358979323846;
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define MP make_pair
ll mult(ll a,ll b){
    return (a*b)%MOD;
}
ll mypow(ll a,ll b){
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}
int arr[maxn];
int pv[maxn];
int32_t main(){
    ios::sync_with_stdio(false),cin.tie(0);
    int n,m;
    cin>>n>>m;
    REP(i,n) cin>>arr[i],pv[i]=arr[i];
    REP(i,m){
        int l,r,x;
        cin>>l>>r>>x;
        --l;
        --r;
        --x;
        int cnt=0;
        for(int j=l;j<=r;j++){
            if(arr[j]<arr[x]) ++cnt;
        }
        if(cnt!=(l-x)){
            cout<<"No\n";
        }
        else cout<<"Yes\n";
    }
}


/*input
5 5
5 4 3 2 1
1 5 3
1 3 1
2 4 3
4 4 4
2 5 3
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll maxn=5e5+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=3.14159265358979323846;
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define MP make_pair
ll mult(ll a,ll b){
    return (a*b)%MOD;
}
ll mypow(ll a,ll b){
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}
int arr[maxn];
int pv[maxn];
int32_t main(){
    ios::sync_with_stdio(false),cin.tie(0);
    int n,m;
    cin>>n>>m;
    REP(i,n) cin>>arr[i],pv[i]=arr[i];
    REP(i,m){
        int l,r,x;
        cin>>l>>r>>x;
        --l;
        --r;
        --x;
        int cnt=0;
        for(int j=l;j<=r;j++){
            if(arr[j]<arr[x]) ++cnt;
        }
        if(cnt!=(x-l)){
            cout<<"No\n";
        }
        else cout<<"Yes\n";
    }
}


/*input
6 5
1 4 3 2 5 6
2 4 3
1 6 2
4 5 4
1 3 3
2 6 3

*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll maxn=5e5+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=3.14159265358979323846;
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define MP make_pair
ll mult(ll a,ll b){
    return (a*b)%MOD;
}
ll mypow(ll a,ll b){
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}
int arr[maxn];
int pv[maxn];
int32_t main(){
    ios::sync_with_stdio(false),cin.tie(0);
    int n,m;
    cin>>n>>m;
    REP(i,n) cin>>arr[i],pv[i]=arr[i];
    REP(i,m){
        int l,r,x;
        cin>>l>>r>>x;
        --l;
        --r;
        --x;
        sort(arr+l,arr+r+1);
        if(arr[x]==pv[x]) cout<<"Yes\n";
        else cout<<"No\n";
        REP(j,n) arr[j]=pv[j];
    }
}


#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>

const double pi=acos(-1.0);
//memset ( a , 0 , n * sizeof(ll) ) ;
using namespace std;
//using namespace __gnu_pbds;
#define   endl    '\n'
#define   sl(n)     scanf("%lld",&n)
#define   mp      make_pair
#define   pb      push_back
#define   ppb     pop_back
#define   fi      first
#define   se      second
#define   ll      long long
#define   ull     unsigned long long
#define   ld      long double
#define   pii     pair<int, int>
#define   f(i,a,b)  for(ll i = (ll)(a); i < (ll)(b); i++)
#define   rf(i,a,b)   for(ll i = (ll)(a); i > (ll)(b); i--)
#define   ms(a,b)   memset((a),(b),sizeof(a))
#define   abs(x)    ((x<0)?(-(x)):(x))
#define   MAX     1000005
#define   inf     LLONG_MAX
#define   ninf    LLONG_MIN
#define   MIN     INT_MIN
#define   yeet    return 0;
#define tihs if(fopen("input.txt","r"))freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout);

#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long  b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}

//typedef
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

int mod = 1e9 +7 ;
int64_t extGcd(int64_t a, int64_t b, int64_t& x, int64_t& y) {if (!a) {x = 0;y = 1;return b;}int64_t x1, y1;int64_t d = extGcd(b % a, a, x1, y1);x = y1 - (b / a) * x1;y = x1;return d;}
inline ll addmod(ll a,ll b){a=a%mod+b%mod;if(a>mod)a%=mod;return a;}
inline ll submod(ll a,ll b){a=a%mod-b%mod;if(a<0)a+=mod;return a;}
inline ll mulmod(ll a,ll b){return (a%mod * b%mod)%mod;}

int dx[]={1,1,0,-1,-1,-1, 0, 1};
int dy[]={0,1,1, 1, 0,-1,-1,-1};
inline ll exp(ll a,ll b){if(a==0)return 0ll;ll r=1LL;while(b>0){if(b&1){r=r*(a%mod);r=(r+mod)%mod;}b/=2;a=(a%mod)*(a%mod);a=(a+mod)%mod;}return (r+mod)%mod;}
ll gcd(ll a,ll b){if(b==0)return a;if(a==0)return b;return gcd(b,a%b);}
uint32 setbits(ll n){uint32 count=0;while (n){n&=(n-1);count++;}return count; }

// ll f[MAX];
// ll iv[MAX];
// ll C(ll n,ll r){
//   if(n<r)return 0;
//   ll ans=(f[n]%mod * iv[r]%mod)%mod;
//   ans=(ans%mod * iv[n-r]%mod)%mod;
//   return ans%mod;
// }
// void init(){
//   f[0]=1;
//      iv[0]=1;
//      f(i,1,MAX)f[i]=(i*f[i-1])%mod;
//      iv[MAX-1]=exp(f[MAX-1],mod-2);

//      for(int i=MAX-2;i>=0;--i)iv[i]=(iv[i+1]*(i+1))%mod;

// }

////****************************************************************************************************************************************************************************************************************////

int main(){
     tihs;
     fast_io;
     int n,m;
     cin>>n>>m;
     int a[n];
     f(i,0,n){
        cin>>a[i];
     }
     while(m--){
          int l,r,x;
          cin>>l>>r>>x;
          if(is_sorted(a+l-1,a+r))cout<<"Yes"<<endl;
          else{
               vector<int>g1;
               for(int i=l-1;i<r;i++){
                    g1.pb(a[i]);
               }
               sort(g1.begin(),g1.end());
               if(a[x-1]==g1[x-1-(l-1)]){cout<<"Yes"<<endl;}
               else cout<<"No"<<endl;
            //   cout<<a[x-1]<<" "<<g1[x-1-(l-1)]<<endl;
          }
     }

      }


#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>

const double pi=acos(-1.0);
//memset ( a , 0 , n * sizeof(ll) ) ;
using namespace std;
//using namespace __gnu_pbds;
#define   endl    '\n'
#define   sl(n)     scanf("%lld",&n)
#define   mp      make_pair
#define   pb      push_back
#define   ppb     pop_back
#define   fi      first
#define   se      second
#define   ll      long long
#define   ull     unsigned long long
#define   ld      long double
#define   pii     pair<int, int>
#define   f(i,a,b)  for(ll i = (ll)(a); i < (ll)(b); i++)
#define   rf(i,a,b)   for(ll i = (ll)(a); i > (ll)(b); i--)
#define   ms(a,b)   memset((a),(b),sizeof(a))
#define   abs(x)    ((x<0)?(-(x)):(x))
#define   MAX     1000005
#define   inf     LLONG_MAX
#define   ninf    LLONG_MIN
#define   MIN     INT_MIN
#define   yeet    return 0;
#define tihs if(fopen("input.txt","r"))freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout);

#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long  b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}

//typedef
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

int mod = 1e9 +7 ;
int64_t extGcd(int64_t a, int64_t b, int64_t& x, int64_t& y) {if (!a) {x = 0;y = 1;return b;}int64_t x1, y1;int64_t d = extGcd(b % a, a, x1, y1);x = y1 - (b / a) * x1;y = x1;return d;}
inline ll addmod(ll a,ll b){a=a%mod+b%mod;if(a>mod)a%=mod;return a;}
inline ll submod(ll a,ll b){a=a%mod-b%mod;if(a<0)a+=mod;return a;}
inline ll mulmod(ll a,ll b){return (a%mod * b%mod)%mod;}

int dx[]={1,1,0,-1,-1,-1, 0, 1};
int dy[]={0,1,1, 1, 0,-1,-1,-1};
inline ll exp(ll a,ll b){if(a==0)return 0ll;ll r=1LL;while(b>0){if(b&1){r=r*(a%mod);r=(r+mod)%mod;}b/=2;a=(a%mod)*(a%mod);a=(a+mod)%mod;}return (r+mod)%mod;}
ll gcd(ll a,ll b){if(b==0)return a;if(a==0)return b;return gcd(b,a%b);}
uint32 setbits(ll n){uint32 count=0;while (n){n&=(n-1);count++;}return count; }

// ll f[MAX];
// ll iv[MAX];
// ll C(ll n,ll r){
//   if(n<r)return 0;
//   ll ans=(f[n]%mod * iv[r]%mod)%mod;
//   ans=(ans%mod * iv[n-r]%mod)%mod;
//   return ans%mod;
// }
// void init(){
//   f[0]=1;
//      iv[0]=1;
//      f(i,1,MAX)f[i]=(i*f[i-1])%mod;
//      iv[MAX-1]=exp(f[MAX-1],mod-2);

//      for(int i=MAX-2;i>=0;--i)iv[i]=(iv[i+1]*(i+1))%mod;

// }

////****************************************************************************************************************************************************************************************************************////

int main(){
     tihs;
     fast_io;
     int n,m;
     cin>>n>>m;
     int a[n];
     f(i,0,n){
        cin>>a[i];
     }
     while(m--){
          int l,r,x;
          cin>>l>>r>>x;
             int pos=0;
             for(int i=l-1;i<r;i++)if(a[i]<a[x-1])pos++;
                pos+=(l-1);
                if(a[pos]==a[x-1])cout<<"Yes"<<endl;
                else cout<<"No"<<endl;

          }

      }


#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>

const double pi=acos(-1.0);
//memset ( a , 0 , n * sizeof(ll) ) ;
using namespace std;
//using namespace __gnu_pbds;
#define   endl    '\n'
#define   sl(n)     scanf("%lld",&n)
#define   mp      make_pair
#define   pb      push_back
#define   ppb     pop_back
#define   fi      first
#define   se      second
#define   ll      long long
#define   ull     unsigned long long
#define   ld      long double
#define   pii     pair<int, int>
#define   f(i,a,b)  for(ll i = (ll)(a); i < (ll)(b); i++)
#define   rf(i,a,b)   for(ll i = (ll)(a); i > (ll)(b); i--)
#define   ms(a,b)   memset((a),(b),sizeof(a))
#define   abs(x)    ((x<0)?(-(x)):(x))
#define   MAX     1000005
#define   inf     LLONG_MAX
#define   ninf    LLONG_MIN
#define   MIN     INT_MIN
#define   yeet    return 0;
#define tihs if(fopen("input.txt","r"))freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout);

#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long  b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}

//typedef
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;

int mod = 1e9 +7 ;
int64_t extGcd(int64_t a, int64_t b, int64_t& x, int64_t& y) {if (!a) {x = 0;y = 1;return b;}int64_t x1, y1;int64_t d = extGcd(b % a, a, x1, y1);x = y1 - (b / a) * x1;y = x1;return d;}
inline ll addmod(ll a,ll b){a=a%mod+b%mod;if(a>mod)a%=mod;return a;}
inline ll submod(ll a,ll b){a=a%mod-b%mod;if(a<0)a+=mod;return a;}
inline ll mulmod(ll a,ll b){return (a%mod * b%mod)%mod;}

int dx[]={1,1,0,-1,-1,-1, 0, 1};
int dy[]={0,1,1, 1, 0,-1,-1,-1};
inline ll exp(ll a,ll b){if(a==0)return 0ll;ll r=1LL;while(b>0){if(b&1){r=r*(a%mod);r=(r+mod)%mod;}b/=2;a=(a%mod)*(a%mod);a=(a+mod)%mod;}return (r+mod)%mod;}
ll gcd(ll a,ll b){if(b==0)return a;if(a==0)return b;return gcd(b,a%b);}
uint32 setbits(ll n){uint32 count=0;while (n){n&=(n-1);count++;}return count; }

// ll f[MAX];
// ll iv[MAX];
// ll C(ll n,ll r){
//   if(n<r)return 0;
//   ll ans=(f[n]%mod * iv[r]%mod)%mod;
//   ans=(ans%mod * iv[n-r]%mod)%mod;
//   return ans%mod;
// }
// void init(){
//   f[0]=1;
//      iv[0]=1;
//      f(i,1,MAX)f[i]=(i*f[i-1])%mod;
//      iv[MAX-1]=exp(f[MAX-1],mod-2);

//      for(int i=MAX-2;i>=0;--i)iv[i]=(iv[i+1]*(i+1))%mod;

// }

////****************************************************************************************************************************************************************************************************************////

int main(){
     tihs;
     fast_io;
     int n,m;
     cin>>n>>m;
     int a[n];
     f(i,0,n){
        cin>>a[i];
     }
     while(m--){
          int l,r,x;
          cin>>l>>r>>x;
          if(is_sorted(a+l-1,a+r))cout<<"Yes"<<endl;
          else{
               vector<int>g1;
               for(int i=l-1;i<r;i++){
                    g1.pb(a[i]);
               }
               sort(g1.begin(),g1.end());
               if(a[x-1]==g1[x-1-(l-1)]){cout<<"Yes"<<endl;}
               else cout<<"No"<<endl;
            //   cout<<a[x-1]<<" "<<g1[x-1-(l-1)]<<endl;
          }
     }

      }


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

//sort在算法里是排序的意思，注意题意
//判断排序后index.x是不是在中间的位置 只需要判断区间内小于a[x]是不是等于x-l即可
int main()
{
    vector<int> a;
    int n,m,tmp;
    cin>>n>>m;
    for(int i=0;i<n;i++){
        cin>>tmp;
        a.push_back(tmp);
    }
    int l,r,x;
    while(m--){
      cin>>l>>r>>x;
      int count=0;
        for(int i=l-1;i<r;i++)
        {
            if(a[i]<a[x-1])
                count++;
        }
        if(count==x-l) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#define lowbit(x) x&(-x)
using namespace std;
typedef long long ll;
const int maxx=1e6+7;
int n,m,cnt,tree[maxx],a[maxx],ans[maxx],sum[maxx],l[maxx];
struct node
{
    int pos,x,id,flag;
    bool operator<(const node&t)
    {
        if(pos==t.pos) return flag<t.flag;
        return pos<t.pos;
    }
}e[maxx];
void add(int x,int v)
{
    while(x<=n)
    {
        tree[x]+=v;
        x+=lowbit(x);
    }
}
int query(int x)
{
    int ans=0;
    while(x)
    {
        ans+=tree[x];
        x-=lowbit(x);
    }
    return ans;
}
int main()
{
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1,r,x;i<=m;i++)
    {
        cin>>l[i]>>r>>x;
        e[++cnt]=node{l[i],x,i,0};
        e[++cnt]=node{r,x,i,1};
    }
    sort(e+1,e+1+cnt);
    for(int i=1,len=1;i<=n;i++)
    {
        while(e[len].pos==i&&!e[len].flag)
        {
            sum[e[len].id]=query(a[e[len].x]);
            //cout<<e[len].pos<<" "<<e[len].flag<<endl;
            len++;
        }
        add(a[i],1);
        while(e[len].pos==i&&e[len].flag)
        {

            //cout<<e[len].pos<<" "<<e[len].flag<<endl;
            if(e[len].x-l[e[len].id]==query(a[e[len].x]-1)-sum[e[len].id])
                ans[e[len].id]=1;
            //cout<<e[len].x-l[e[len].id]<<" "<<query(a[e[len].x]-1)-sum[e[len].id]<<endl;
            len++;
        }
    }
    for(int i=1;i<=m;i++)
        if(ans[i]) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
}


#include <bits/stdc++.h>
#define lowbit(x) x&(-x)
using namespace std;
typedef long long ll;
const int maxx=1e6+7;
int n,m,cnt,tree[maxx],a[maxx],ans[maxx],sum[maxx],l[maxx];
struct node
{
    int pos,x,id,flag;
    bool operator<(const node&t)
    {
        if(pos==t.pos) return flag<t.flag;
        return pos<t.pos;
    }
}e[maxx];
void add(int x,int v)
{
    while(x<=n)
    {
        tree[x]+=v;
        x+=lowbit(x);
    }
}
int query(int x)
{
    int ans=0;
    while(x)
    {
        ans+=tree[x];
        x-=lowbit(x);
    }
    return ans;
}
int main()
{
    ios::sync_with_stdio(0);
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1,r,x;i<=m;i++)
    {
        cin>>l[i]>>r>>x;
        e[++cnt]=node{l[i],x,i,0};
        e[++cnt]=node{r,x,i,1};
    }
    sort(e+1,e+1+cnt);
    for(int i=1,len=1;i<=n;i++)
    {
        while(e[len].pos==i&&!e[len].flag)
        {
            sum[e[len].id]=query(a[e[len].x]);
            //cout<<e[len].pos<<" "<<e[len].flag<<endl;
            len++;
        }
        add(a[i],1);
        while(e[len].pos==i&&e[len].flag)
        {

            //cout<<e[len].pos<<" "<<e[len].flag<<endl;
            if(e[len].x-l[e[len].id]==query(a[e[len].x]-1)-sum[e[len].id])
                ans[e[len].id]=1;
            //cout<<e[len].x-l[e[len].id]<<" "<<query(a[e[len].x]-1)-sum[e[len].id]<<endl;
            len++;
        }
    }
    for(int i=1;i<=m;i++)
        if(ans[i]) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
}


#include <bits/stdc++.h>
#define lowbit(x) x&(-x)
using namespace std;
typedef long long ll;
const int maxx=1e6+7;
int n,m,cnt,tree[maxx],a[maxx],ans[maxx],sum[maxx],l[maxx];
struct node
{
    int pos,x,id,flag;
    bool operator<(const node&t)
    {
        if(pos==t.pos) return flag<t.flag;
        return pos<t.pos;
    }
}e[maxx];
void add(int x,int v)
{
    while(x<=n)
    {
        tree[x]+=v;
        x+=lowbit(x);
    }
}
int query(int x)
{
    int ans=0;
    while(x)
    {
        ans+=tree[x];
        x-=lowbit(x);
    }
    return ans;
}
int main()
{
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1,r,x;i<=m;i++)
    {
        cin>>l[i]>>r>>x;
        e[++cnt]=node{l[i],x,i,0};
        e[++cnt]=node{r,x,i,1};
    }
    sort(e+1,e+1+cnt);
    for(int i=1,len=1;i<=n;i++)
    {
        while(e[len].pos==i&&!e[len].flag)
        {
            sum[e[len].id]=query(a[e[len].x]);
            //cout<<e[len].pos<<" "<<e[len].flag<<endl;
            len++;
        }
        add(a[i],1);
        while(e[len].pos==i&&e[len].flag)
        {

            //cout<<e[len].pos<<" "<<e[len].flag<<endl;
            if(e[len].x-l[e[len].id]==query(a[e[len].x]-1)-sum[e[len].id])
                ans[e[len].id]=1;
            //cout<<e[len].x-l[e[len].id]<<" "<<query(a[e[len].x]-1)-sum[e[len].id]<<endl;
            len++;
        }
    }
    for(int i=1;i<=m;i++)
        if(ans[i]) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
}


#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<long long ,long long >
#define ppll pair < pll , pll >
#define mod 1000000007
unsigned int bp(int n) // built_in_pop_count //
{
    unsigned int count = 0;
    while (n) {
        n &= (n - 1);
        count++;
    }
    return count;
}
int32_t main(){
    SPEED;
    int n, m;
    cin >> n >> m;
    vector<int> arr(n + 1);
    for(int i = 1; i <= n; ++i){
        cin >> arr[i];
    }
    while(m--){
        int l, r, x;
        cin >> l >> r >> x;
        int cnt = 0;
        for(int i = l; i <= r; ++i){
            if(arr[i] < arr[x]){
                cnt++;
            }
        }
        if(l + cnt == x) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<long long ,long long >
#define ppll pair < pll , pll >
#define mod 1000000007
unsigned int bp(int n) // built_in_pop_count //
{
    unsigned int count = 0;
    while (n) {
        n &= (n - 1);
        count++;
    }
    return count;
}
int32_t main(){
    SPEED;
    int n, m;
    cin >> n >> m;
    vector<int> arr(n);
    for(int i = 1; i <= n; ++i){
        cin >> arr[i];
    }
    while(m--){
        int l, r, x;
        cin >> l >> r >> x;
        int cnt = 0;
        for(int i = l; i <= r; ++i){
            if(arr[i] < arr[x]){
                cnt++;
            }
        }
        if(l + cnt == x) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<long long ,long long >
#define ppll pair < pll , pll >
#define mod 1000000007
unsigned int bp(int n) // built_in_pop_count //
{
    unsigned int count = 0;
    while (n) {
        n &= (n - 1);
        count++;
    }
    return count;
}
int32_t main(){
    SPEED;
    int n, m;
    cin >> n >> m;
    int arr[n + 1];
    for(int i = 1; i <= n; ++i){
        cin >> arr[i];
    }
    while(m--){
        int l, r, x;
        cin >> l >> r >> x;
        int cnt = 0;
        for(int i = l; i <= r; ++i){
            if(arr[i] < arr[x]){
                cnt++;
            }
        }
        if(l + cnt == x) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<long long ,long long >
#define ppll pair < pll , pll >
#define mod 1000000007
unsigned int bp(int n) // built_in_pop_count //
{
    unsigned int count = 0;
    while (n) {
        n &= (n - 1);
        count++;
    }
    return count;
}
int32_t main(){
    SPEED;
    int n, m;
    cin >> n >> m;
    vector<int> arr, arrc;
    for(int i = 1; i <= n; ++i){
        int x;
        cin >> x;
        arr.pb(x);
    }
    arrc = arr;
    while(m--){
        int l, r, x;
        cin >> l >> r >> x;
        l--;
        int Original = arr[x - 1];
        sort(arrc.begin() + l , arrc.begin() + r);
        if(arrc[x - 1] == Original){
            cout << "Yes" << endl;
        }
        else cout << "No" << endl;
        arrc = arr;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<long long ,long long >
#define ppll pair < pll , pll >
#define mod 1000000007
unsigned int bp(int n) // built_in_pop_count //
{
    unsigned int count = 0;
    while (n) {
        n &= (n - 1);
        count++;
    }
    return count;
}
int32_t main(){
    SPEED;
    int n, m;
    cin >> n >> m;
    vector<int> arr, arrc;
    vpp track;
    for(int i = 1; i <= n; ++i){
        int x;
        cin >> x;
        arr.pb(x);
        track.pb(mp(x , i));
    }
    sort(track.begin(), track.end());
    arrc = arr;
    while(m--){
        int l, r, x;
        cin >> l >> r >> x;
        l--;
        int Original = track[x - 1].se;
        sort(arrc.begin() + l , arrc.begin() + r);
        if(arrc[x - 1] == Original){
            cout << "Yes" << endl;
        }
        else cout << "No" << endl;
        arrc = arr;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<long long ,long long >
#define ppll pair < pll , pll >
#define mod 1000000007
unsigned int bp(int n) // built_in_pop_count //
{
    unsigned int count = 0;
    while (n) {
        n &= (n - 1);
        count++;
    }
    return count;
}
int32_t main(){
    SPEED;
    int n, m;
    cin >> n >> m;
    vector<int> arr, arrc;
    vpp track;
    for(int i = 1; i <= n; ++i){
        int x;
        cin >> x;
        arr.pb(x);
        track.pb(mp(x , i));
    }
    sort(track.begin(), track.end());
    arrc = arr;
    while(m--){
        int l, r, x;
        cin >> l >> r >> x;
        l--;
        int Original = track[x - 1].se;
        sort(arrc.begin() + l , arrc.begin() + r);
        if(arrc[x - 1] == Original){
            cout << "YES" << endl;
        }
        else cout << "NO" << endl;
        arrc = arr;
    }
}


#include <bits/stdc++.h>

using namespace std;

bool checkIfChanges(vector<int> original, int index, int l, int r){
	vector<int> newVi;

	for (auto it = original.begin() + l - 1; it != original.begin() + r; it ++){
		newVi.push_back(*it);
	}

	sort(newVi.begin(), newVi.end());

	return newVi[index - l] == original[index - 1];
}

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n, m; cin >> n >> m;

	vector<int> pages(n);
	int page;

	for(int i = 0; i<n; i++){
		cin >> page;
		pages[i] = page;
	}

	int l, x, r;

	for(int i = 0; i < m; i++){
		cin >> l >> r >> x;

		if(checkIfChanges(pages, x, l , r)) {
			cout << "Yes" << "\n";
		} else cout << "No" << "\n";
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int getIndex(vector<int> vi, int target, int l, int r){
	for(auto it = vi.begin(); it != vi.end(); it++){
		//cout << *it << endl;
		//cout << target << endl;
		if(*it == target) return it - vi.begin();
	}
	return -1;
}

bool checkIfChanges(vector<int> original, int index, int target){
	vector<int> newVi;
	copy(original.begin(), original.end(), back_inserter(newVi));

	sort(newVi.begin(), newVi.end());
	//cout << original[0] << " " << original[1] << endl;
	if(newVi[index] == target) return false;
	return true;
}

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n, m; cin >> n >> m;

	vector<int> pages(n);
	int page;

	for(int i = 0; i<n; i++){
		cin >> page;
		pages[i] = page;
	}

	int l, x, r;

	for(int i = 0; i < m; i++){
		cin >> l >> r >> x;
		int index = getIndex(pages, x, l, r);
		if(checkIfChanges(pages, index, x)) {
			cout << "No" << "\n";
		} else cout << "Yes" << "\n";
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

bool checkIfChanges(vector<int> original, int index, int l, int r){

	int countLess = 0;
	int target = original[index - 1];

	for(auto it = original.begin() + l -1 ; it != original.begin() + r; it++){
		if(*it < target) countLess++;
	}

	return l + countLess == index;
}

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n, m; cin >> n >> m;

	vector<int> pages(n);
	int page;

	for(int i = 0; i<n; i++){
		cin >> page;
		pages[i] = page;
	}

	int l, x, r;

	for(int i = 0; i < m; i++){
		cin >> l >> r >> x;

		if(checkIfChanges(pages, x, l , r)) {
			cout << "Yes" << "\n";
		} else cout << "No" << "\n";
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

//int getIndex(vector<int> vi, int target){
	//for(auto it = vi.begin(); it != vi.end(); it++){
		//if(*it == target) return it - vi.begin();
	//}
	//return -1;
//}

bool checkIfChanges(vector<int> original, int index, int l, int r){
	vector<int> newVi;
	vector<int> toCompare = original;

	for (auto it = original.begin() + l - 1; it != original.begin() + r; it ++){
		newVi.push_back(*it);
	}

	sort(newVi.begin(), newVi.end());

	int j = 0;
	for(int i = l - 1; i < r; i++){
		toCompare[i] = newVi[j++];
	}

	return toCompare[index - 1] == original[index - 1];
}

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n, m; cin >> n >> m;

	vector<int> pages(n);
	int page;

	for(int i = 0; i<n; i++){
		cin >> page;
		pages[i] = page;
	}

	int l, x, r;

	for(int i = 0; i < m; i++){
		cin >> l >> r >> x;

		if(checkIfChanges(pages, x, l , r)) {
			cout << "Yes" << "\n";
		} else cout << "No" << "\n";
	}

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long

int32_t main() {
    IOS;
    int n,m;
    cin>>n>>m;

    vector<int>A;

    for(int i=1; i<=n; i++){
		int val;
		cin>>val;
		A.push_back(val);
	}

    for(int j=0; j<m; j++){
		int l,r,x;
		cin>>l>>r>>x;
		l-=1;
		r-=1;
		x-=1;
		int prev=A[x];
		if(x<l && x>r){
			cout<<"Yes"<<endl;
			continue;
		}
		vector<int>B;
		for(int i=l; i<=r; i++){
			B.push_back(A[i]);
		}
		sort(B.begin(), B.end());
		x=x-l;
		if(B[x]!=prev) cout<<"No"<<endl;
		else cout<<"Yes"<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long

int32_t main() {
    IOS;
    int n,m;
    cin>>n>>m;
    int A[n+1];
    for(int i=1; i<=n; i++) cin>>A[i];

    while(m--){
		int l,r,x;
		cin>>l>>r>>x;

		int val=A[x];
		int less=0, eq=0;
		for(int i=l; i<=r; i++){
			if(A[i]<val) less++;
			else if(A[i]==val) eq++;
		}
		x-=(l-1);
		if(x>less && x<=(less+eq)) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long

int32_t main() {
    IOS;
    int n,m;
    cin>>n>>m;
    //int A[n+1];
    vector<int>A;
    //A.push_back(-1);
    for(int i=1; i<=n; i++){
		int val;
		cin>>val;
		A.push_back(val);
	}

    for(int j=0; j<m; j++){
		int l,r,x;
		cin>>l>>r>>x;
		l-=1;
		r-=1;
		int prev=A[x-1];
		vector<int>B(n,0);
		for(int i=0; i<n; i++){
			B[i]=A[i];
		}
		sort(B.begin()+l, B.begin()+r+1);
		//cout<<endl;
		if(B[x-1]!=prev) cout<<"No"<<endl;
		else cout<<"Yes"<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int t,k,n;
    cin>>t;
    while(t--){
        cin>>n>>k;
        if(k>n)
        cout<<(k-n);
        else if(k%2==0 && n%2==0)
        cout<<0;
        else
        cout<<1;
    }
}