// AOJ 2079: Dance Dance Revolution
// 2017.10.4 bal4u@uu

#include <stdio.h>

char buf[100003];

int main()
{
	int n, ans;
	char *p;

	scanf("%d", &n);
	while (n-- > 0) {
		scanf("%s", buf+1);
		p = buf, *p++ = '0'; ans = 1;
		while (*p) {
			if (*p == *(p-1)) { ans = 0; break; }
			p++;
		}
		puts(ans ? "Yes" : "No");
	}
	return 0;
}