import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int n = sc.nextInt();
while (n-- > 0) {
String str = sc.next();
if (str.length() % 4 != 0)
System.out.println("No");
else {
long len = str.length() / 4;
StringBuffer ans = new StringBuffer("");
StringBuffer temp = new StringBuffer("2050");
while (len > 0) {
if (len % 2 == 1) {
ans.append(temp);
}
temp.append(temp);
len = len >> 1;
}
String str2 = ans + "";
if (str2.equals(str))
System.out.println("Yes");
else
System.out.println("No");
}
}
}
}
}