#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 *, ...);
int strlen(char *);
int main() {
  int t, i, len;
  scanf("%d", &t);
  while (t--) {
    char str[100];
    int flag = 0;
    scanf("%s", &str);
    len = strlen(str);
    for (i = 0; i < len; i++) {
      if (str[i] == 'D' || str[i] == 'J' || str[i] - 48 == 0) {
        flag = 1;
        break;
      }
    }
    if (flag == 1)
      printf("YES\n");
    else
      printf("NO\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     122d <main+0xfd>
movl   $0x0,-0x84(%rbp)
lea    0xe8a(%rip),%rdi
lea    -0x80(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x80(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11fe <main+0xce>
movslq -0xc(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x44,%eax
je     11dc <main+0xac>
movslq -0xc(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x4a,%eax
je     11dc <main+0xac>
movslq -0xc(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
sub    $0x30,%eax
cmp    $0x0,%eax
jne    11eb <main+0xbb>
movl   $0x1,-0x84(%rbp)
jmp    11fe <main+0xce>
jmp    11f0 <main+0xc0>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1197 <main+0x67>
cmpl   $0x1,-0x84(%rbp)
jne    121c <main+0xec>
lea    0xdf4(%rip),%rdi
call   1040 <printf@plt>
jmp    1228 <main+0xf8>
lea    0xde8(%rip),%rdi
call   1040 <printf@plt>
jmp    1154 <main+0x24>
mov    -0x4(%rbp),%eax
add    $0x90,%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    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
subl   $0x1,0xc(%rsp)
jae    116d <main+0x3d>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xe8f(%rip),%r14
lea    0x10(%rsp),%r13
lea    0xe86(%rip),%r15
lea    0xe82(%rip),%r12
mov    $0x4100001,%ebx
jmp    11ac <main+0x7c>
mov    %r15,%rdi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
call   1030 <puts@plt>
subl   $0x1,0xc(%rsp)
jb     115a <main+0x2a>
mov    %r14,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %r13,%rdi
call   1040 <strlen@plt>
mov    %r15,%rdi
test   %eax,%eax
jle    11a0 <main+0x70>
mov    %eax,%eax
xor    %ecx,%ecx
jmp    11d9 <main+0xa9>
xchg   %ax,%ax
add    $0x1,%rcx
cmp    %rcx,%rax
je     118e <main+0x5e>
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 = [3 x i8] c"%d\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 i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [100 x i8]
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %8
8: ; preds = %54, %0
%9 = load i32, i32* %2
%10 = add nsw i32 %9, -1
store i32 %10, i32* %2
%11 = icmp ne i32 %9, 0
br i1 %11, label %12, label %55
12: ; preds = %8
store i32 0, i32* %6
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [100 x i8]* %5)
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
store i32 %15, i32* %4
store i32 0, i32* %3
br label %16
16: ; preds = %44, %12
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %47
20: ; preds = %16
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %5, 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 %42, label %27
27: ; preds = %20
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 74
br i1 %33, label %42, label %34
34: ; preds = %27
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = sub nsw i32 %39, 48
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %34, %27, %20
store i32 1, i32* %6
br label %47
43: ; preds = %34
br label %44
44: ; preds = %43
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
store i32 %46, i32* %3
br label %16
47: ; preds = %42, %16
%48 = load i32, i32* %6
%49 = icmp eq i32 %48, 1
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %54
52: ; preds = %47
%53 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %54
54: ; preds = %52, %50
br label %8
55: ; preds = %8
%56 = load i32, i32* %1
ret i32 %56
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\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 i32
%2 = alloca [100 x i8]
%3 = bitcast i32* %1 to i8*
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = add nsw i32 %5, -1
store i32 %6, i32* %1
%7 = icmp eq i32 %5, 0
br i1 %7, label %29, label %8
8: ; preds = %0
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
br label %10
10: ; preds = %8, %23
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [100 x i8]* %2)
%12 = call i32 @strlen(i8* %9)
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %23
14: ; preds = %10
%15 = zext i32 %12 to i64
br label %16
16: ; preds = %14, %20
%17 = phi i64 [ 0, %14 ], [ %21, %20 ]
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %17
%19 = load i8, i8* %18
switch i8 %19, label %20 [
i8 68, label %23
i8 74, label %23
i8 48, label %23
]
20: ; preds = %16
%21 = add nuw nsw i64 %17, 1
%22 = icmp eq i64 %21, %15
br i1 %22, label %23, label %16
23: ; preds = %20, %16, %16, %16, %10
%24 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0), %10 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0), %16 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0), %16 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0), %16 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0), %20 ]
%25 = call i32 @puts(i8* dereferenceable(1) %24)
%26 = load i32, i32* %1
%27 = add nsw i32 %26, -1
store i32 %27, i32* %1
%28 = icmp eq i32 %26, 0
br i1 %28, label %29, label %10
29: ; preds = %23, %0
ret i32 0
}