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

int main() {
	// your code goes here
	int t; cin >> t;
	while(t--)
	{
	    int len, q; cin >> len >> q;
	    string str; cin >> str;
	    vector<bool> left0(len, false);
	    vector<bool> left1(len, false);
	    vector<bool> right0(len, false);
	    vector<bool> right1(len, false);
	    for(int i=1;i<len;i++)
	    {
	        left0[i] = left0[i-1];
	        left1[i] = left1[i-1];
	        if(str[i-1] == '0') left0[i] = true;
	        else left1[i] = true;
	        //cout << left0[i] << " " << left1[i]  << endl;
	    }
	    for(int i=len-2;i>=0;i--)
	    {
	        right0[i] = right0[i+1];
	        right1[i] = right1[i+1];
	        if(str[i+1] == '0') right0[i] = true;
	        else right1[i] = true;
	        //cout << right0[i] << " " << right1[i]  << endl;
	    }
	    while(q--)
	    {
	        int l,r; cin>>l >> r;
	        //cout << l << " " << r << endl;
	        l--;r--;
	        if(str[l] == '0')
	        {
	            if(left0[l]){ cout << "YES\n"; continue; }
	        }
	        else if(str[l] == '1')
	        {
	            if(left1[l]){ cout << "YES\n";continue; }
	        }
	        if(str[r] == '0')
	        {
	            if(right0[r]){ cout << "YES\n";continue; }
	        }
	        else if(str[r] == '1')
	        {
	            if(right1[r]){ cout << "YES\n";continue;}
	        }
	        cout << "NO\n";
	    }
	    
	}
	return 0;
}
