// In the name of god
#include <bits/stdc++.h>

#define F first
#define S second
#define p push_back
#define all(x) x.begin(), x.end()
#define Sort(a) sort(all(x))
#define debug(x) cerr << #x << " : " << x << "\n"
#define use_file freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef string str;

const ll maxn = 1e6 + 5, inf = 1e18, mod = 1e9 + 7, cnt = 5e5;
ll n, m, t, ps[2][maxn];
str s;
int main(){
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> t;
	while(t --){
		cin >> n >> m;
		cin >> s;
		s += '2';
		for(ll i = 1; i <= n + 1; i ++){
			if(s[i - 1] == '1')ps[1][i] ++;
			if(s[i - 1] == '0')ps[0][i] ++;
			ps[0][i] += ps[0][i - 1];
			ps[1][i] += ps[1][i - 1];
//			debug(i);
//			debug(ps[0][i]);
		}
		while(m --){
			ll l, r;
			cin >> l >> r;
			ll x = s[r - 1] - '0', y = s[l - 1] - '0';
			if((ps[x][n + 1] - ps[x][r]) || (ps[y][l - 1] - ps[y][0]))cout << "YES" << endl;
			else cout << "NO" << endl;
		}
		for(ll i = 1; i <= n + 1; i ++){
			ps[0][i] = 0;
			ps[1][i] = 0;
		}
	}
}
