#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
long long strlen(char *);
int main() {
  long long int t, l, i, flag;
  char s[110];
  scanf("%lld", &t);
  while (t--) {
    scanf("%s", s);
    l = strlen(s);
    flag = 0;
    for (i = 0; i < l; i++) {
      if (s[i] == 'D' || s[i] == 'J' || s[i] == '0') {
        flag = 1;
        printf("YES\n");
        break;
      }
    }
    if (flag == 0)
      printf("NO\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
cmp    $0x0,%rax
je     123a <main+0x10a>
lea    -0xa0(%rbp),%rsi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0xa0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    121e <main+0xee>
mov    -0x20(%rbp),%rax
movsbl -0xa0(%rbp,%rax,1),%eax
ff
cmp    $0x44,%eax
je     11ef <main+0xbf>
mov    -0x20(%rbp),%rax
movsbl -0xa0(%rbp,%rax,1),%eax
ff
cmp    $0x4a,%eax
je     11ef <main+0xbf>
mov    -0x20(%rbp),%rax
movsbl -0xa0(%rbp,%rax,1),%eax
ff
cmp    $0x30,%eax
jne    1208 <main+0xd8>
movq   $0x1,-0x28(%rbp)
lea    0xe0a(%rip),%rdi
call   1040 <printf@plt>
jmp    121e <main+0xee>
jmp    120d <main+0xdd>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11a2 <main+0x72>
cmpq   $0x0,-0x28(%rbp)
jne    1235 <main+0x105>
lea    0xddd(%rip),%rdi
call   1040 <printf@plt>
jmp    1154 <main+0x24>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x80,%rsp
lea    0xeb9(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
subq   $0x1,0x8(%rsp)
jae    116e <main+0x3e>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xe90(%rip),%r14
lea    0x10(%rsp),%r13
lea    0xe87(%rip),%r15
lea    0xe83(%rip),%r12
mov    $0x4100001,%ebx
jmp    11ad <main+0x7d>
mov    %r15,%rdi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
call   1030 <puts@plt>
subq   $0x1,0x8(%rsp)
jb     115b <main+0x2b>
mov    %r14,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %r13,%rdi
call   1040 <strlen@plt>
mov    %r15,%rdi
test   %rax,%rax
jle    11a0 <main+0x70>
xor    %ecx,%ecx
jmp    11d9 <main+0xa9>
xchg   %ax,%ax
add    $0x1,%rcx
cmp    %rcx,%rax
je     118f <main+0x5f>
movzbl 0x10(%rsp,%rcx,1),%edx
add    $0xd0,%dl
cmp    $0x1a,%dl
ja     11d0 <main+0xa0>
movzbl %dl,%edx
bt     %rdx,%rbx
jae    11d0 <main+0xa0>
mov    %r12,%rdi
jmp    11a0 <main+0x70>

LLVM IR (-O0):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [5 x i8] c"YES\0A\00"
@.str.3 = [4 x i8] c"NO\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca [110 x i8]
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %2)
br label %8
8: ; preds = %50, %0
%9 = load i64, i64* %2
%10 = add nsw i64 %9, -1
store i64 %10, i64* %2
%11 = icmp ne i64 %9, 0
br i1 %11, label %12, label %51
12: ; preds = %8
%13 = getelementptr inbounds [110 x i8], [110 x i8]* %6, i64 0, i64 0
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [110 x i8], [110 x i8]* %6, i64 0, i64 0
%16 = call i64 @strlen(i8* %15)
store i64 %16, i64* %3
store i64 0, i64* %5
store i64 0, i64* %4
br label %17
17: ; preds = %42, %12
%18 = load i64, i64* %4
%19 = load i64, i64* %3
%20 = icmp slt i64 %18, %19
br i1 %20, label %21, label %45
21: ; preds = %17
%22 = load i64, i64* %4
%23 = getelementptr inbounds [110 x i8], [110 x i8]* %6, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 68
br i1 %26, label %39, label %27
27: ; preds = %21
%28 = load i64, i64* %4
%29 = getelementptr inbounds [110 x i8], [110 x i8]* %6, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 74
br i1 %32, label %39, label %33
33: ; preds = %27
%34 = load i64, i64* %4
%35 = getelementptr inbounds [110 x i8], [110 x i8]* %6, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 48
br i1 %38, label %39, label %41
39: ; preds = %33, %27, %21
store i64 1, i64* %5
%40 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %45
41: ; preds = %33
br label %42
42: ; preds = %41
%43 = load i64, i64* %4
%44 = add nsw i64 %43, 1
store i64 %44, i64* %4
br label %17
45: ; preds = %39, %17
%46 = load i64, i64* %5
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %45
%49 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %50
50: ; preds = %48, %45
br label %8
51: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [3 x i8] c"%s\00"
@str = [3 x i8] c"NO\00"
@str.4 = [4 x i8] c"YES\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca [110 x i8]
%3 = bitcast i64* %1 to i8*
%4 = getelementptr inbounds [110 x i8], [110 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%6 = load i64, i64* %1
%7 = add nsw i64 %6, -1
store i64 %7, i64* %1
%8 = icmp eq i64 %6, 0
br i1 %8, label %26, label %9
9: ; preds = %0, %20
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%11 = call i64 @strlen(i8* %4)
%12 = icmp sgt i64 %11, 0
br i1 %12, label %13, label %20
13: ; preds = %9, %17
%14 = phi i64 [ %18, %17 ], [ 0, %9 ]
%15 = getelementptr inbounds [110 x i8], [110 x i8]* %2, i64 0, i64 %14
%16 = load i8, i8* %15
switch i8 %16, label %17 [
i8 68, label %20
i8 74, label %20
i8 48, label %20
]
17: ; preds = %13
%18 = add nuw nsw i64 %14, 1
%19 = icmp eq i64 %18, %11
br i1 %19, label %20, label %13
20: ; preds = %17, %13, %13, %13, %9
%21 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0), %9 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0), %13 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0), %13 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0), %13 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0), %17 ]
%22 = call i32 @puts(i8* dereferenceable(1) %21)
%23 = load i64, i64* %1
%24 = add nsw i64 %23, -1
store i64 %24, i64* %1
%25 = icmp eq i64 %23, 0
br i1 %25, label %26, label %9
26: ; preds = %20, %0
ret i32 0
}