#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
#define io ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)

using namespace std;

const int MAXN = 107;

char a[MAXN];
int test, n, q, nxt[MAXN][2], d[MAXN][2];

int main()
{
//	freopen("test.INP","r",stdin);
	io;
	int test;
	cin >> test;
	while (test--)
	{
		cin >> n >> q;
		for (int i = 1; i <= n; ++i) cin >> a[i];
		nxt[n + 1][0] = nxt[n + 1][1] = nxt[n][0] = -1, nxt[n][1] = -1;
		d[n + 1][0] = d[n + 1][1] = d[n][0] = d[n][1] = 0;
		for (int i = n - 1; i >= 0; --i) 
			for (int j = 0; j < 2; ++j)
			{
				nxt[i][j] = (((a[i + 1] - '0') == j) ? i + 1 : nxt[i + 1][j]);
				d[i][j] = (((a[i + 1] - '0') == j) ? 1 : d[i + 1][j]);
			}
		
		while (q--)
		{
			int l, r;
			cin >> l >> r;
			int fir = 0;
			bool ok = 1, pass = 1;
			for (int t = l; t < r; ++t)
			{
				int nx = nxt[fir][a[t] - '0'], old = fir;
				if (nx == -1) 
				{
					ok = 0;
					break;
				}else fir = nx;
				if (fir != old + 1 && old != 0) pass = 0;
			}
			if (ok) ok = d[fir + pass][a[r] - '0'];
			cout << (ok ? "YES" : "NO") << '\n';
		}
	}
	return 0;
}