import java.io.PrintWriter; import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); PrintWriter pw = new PrintWriter(System.out); for (int z = 0; z < t; z++) { int n = sc.nextInt(); char[] s = sc.next().toCharArray(); boolean[] dp00 = new boolean[n + 2]; boolean[] dp01 = new boolean[n + 2]; boolean[] dp10 = new boolean[n + 2]; boolean[] dp11 = new boolean[n + 2]; if (s[0] != '1') { dp00[0] = true; dp10[0] = true; } if (s[0] != '0') { dp01[0] = true; dp11[0] = true; } if (s[1] != '1') { if (dp00[0] || dp10[0]) { dp00[1] = true; } if (dp01[0] || dp11[0]) { dp10[1] = true; } } if (s[1] != '0') { if (dp00[0] || dp10[0]) { dp01[1] = true; } if (dp01[0] || dp11[0]) { dp11[1] = true; } } for (int i = 2; i < n + 2; i++) { if (s[i % n] != '1') { if (dp10[i - 1]) { dp00[i] = true; } if (dp01[i - 1] || dp11[i - 1]) { dp10[i] = true; } } if (s[i % n] != '0') { if (dp00[i - 1] || dp10[i - 1]) { dp01[i] = true; } if (dp01[i - 1]) { dp11[i] = true; } } } if (dp00[n + 1] || dp01[n + 1] || dp10[n + 1] || dp11[n + 1]) { pw.println("Yes"); } else { pw.println("No"); } } pw.flush(); sc.close(); } }