import sys input = lambda :sys.stdin.readline()[:-1] ni = lambda :int(input()) na = lambda :list(map(int,input().split())) yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES") no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO") ####################################################################### def f(x): if x == "0": return [0] elif x == "1": return [1] else: return [0,1] for _ in range(ni()): n = ni() s = input() ok = 0 for a in f(s[0]): for b in f(s[1]): dp = [[0] * 4 for i in range(n-1)] dp[0][a * 2 + b] = 1 for i in range(n-2): for j in range(4): if dp[i][j] ^ 1: continue nj = j % 2 for k in f(s[i+2]): x = j * 2 + k if x in [0,7]:continue dp[i+1][x % 4] = 1 for j in range(4): if (j % 2)*4 + a * 2 + b in [0, 7] or j * 2 + a in [0,7]:continue if dp[-1][j]: ok = 1 if ok: break if ok: break if ok: Yes() else: No()