maybe there is some issue with the size of character array
/* package codechef; // don’t place package name! */
import java.util.Arrays;
import java.util.Scanner;
/* Name of the class has to be “Main” only if the class is public. */
class CodechefLONGSEQ {
public static void main(String[] args) throws java.lang.Exception {
try{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
String str = sc.next();
char[] array = str.toCharArray();
Arrays.sort(array);
System.out.println(((array[0] == '0' & array[1] == '1') || (array[str.length() - 2] == '0' & array[str.length() - 1] == '1') ? "Yes" : "No"));
}
}catch(Exception e){}
}
}