public class Main{
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int line = sc.nextInt();
String strs[] = new String[line];
for (int i = 0; i < strs.length; i++) {
strs[i] = sc.next();
}
for (int i = 0; i < strs.length; i++) {
String[] split = strs[i].split("2050");
if(split.length == 0){
strs[i] = "Yes";
}else{
strs[i] = "No";
}
}
for (int i = 0; i < strs.length; i++) {
System.out.println(strs[i]);
}