from math import sqrt,sin,cos,tan,ceil,radians,floor,gcd,exp,log,log10,log2,factorial,fsum from heapq import heapify, heappop, heappush from bisect import bisect_left, bisect_right from copy import deepcopy import copy import random from random import randrange from collections import deque,Counter,defaultdict from itertools import permutations,combinations from decimal import Decimal,ROUND_HALF_UP #tmp = Decimal(mid).quantize(Decimal('0'), rounding=ROUND_HALF_UP) from functools import lru_cache, reduce #@lru_cache(maxsize=None) from operator import add,sub,mul,xor,and_,or_,itemgetter import sys input = sys.stdin.readline # .rstrip() INF = 10**18 mod1 = 10**9+7 mod2 = 998244353 #DecimalならPython #再帰ならPython!!!!!!!!!!!!!!!!!!!!!!!!!! ''' dpだとは思う 直前の二個を記録すればいいかな ''' for _ in range(int(input())): N = int(input()) S = list(input().rstrip()) dp = [[[0]*2 for _ in range(2)] for _ in range(N+1)] for i in range(2): for j in range(2): dp[0][i][j] = 1 for i in range(1,N+1): if S[i-1] == '0': for j in range(2): dp[i][j][0] = max(dp[i][j][0], dp[i-1][1][j]) dp[i][1][0] = max(dp[i][1][0], dp[i-1][0][1]) elif S[i-1] == '1': for j in range(2): dp[i][j][1] = max(dp[i][j][1], dp[i-1][0][j]) dp[i][0][1] = max(dp[i][0][1], dp[i-1][1][0]) else: for j in range(2): dp[i][j][0] = max(dp[i][j][0], dp[i-1][1][j]) dp[i][j][1] = max(dp[i][j][1], dp[i-1][0][j]) dp[i][1][0] = max(dp[i][1][0], dp[i-1][0][1]) dp[i][0][1] = max(dp[i][0][1], dp[i-1][1][0]) f = 0 if S[0] == '1': if S[1] == '1': if dp[N][0][0] == 1 or dp[N][1][0] == 1: f = 1 else: if dp[N][0][1] == 1 or dp[N][1][0] == 1 or dp[N][0][0] == 1: f = 1 elif S[0] == '0': if S[1] == '0': if dp[N][1][1] == 1 or dp[N][0][1] == 1: f = 1 else: if dp[N][0][1] == 1 or dp[N][1][0] == 1 or dp[N][1][1] == 1: f = 1 else: if dp[N][0][1] == 1 or dp[N][1][0] == 1 or dp[N][0][0] == 1 or dp[N][1][1] == 1: f = 1 if f: print('Yes') else: print('No')