#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*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int strlen(char *);
int main() {
  int t, i, len;
  scanf("%d", &t);
  while (t--) {
    char str[100];
    int flag = 0;
    gets(str);
    len = strlen(str);
    for (i = 0; i < len; i++) {
      if (str[i] == 'D' || str[i] == 'J' || str[i] == 'O') {
        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    0xea7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     123b <main+0xfb>
movl   $0x0,-0x84(%rbp)
lea    -0x80(%rbp),%rdi
call   1050 <gets@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    1200 <main+0xc0>
movslq -0xc(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x44,%eax
je     11de <main+0x9e>
movslq -0xc(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x4a,%eax
je     11de <main+0x9e>
movslq -0xc(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x4f,%eax
jne    11ed <main+0xad>
movl   $0x1,-0x84(%rbp)
jmp    1200 <main+0xc0>
jmp    11f2 <main+0xb2>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    119c <main+0x5c>
movl   $0x1,-0x84(%rbp)
mov    $0x1,%al
test   $0x1,%al
jne    1219 <main+0xd9>
jmp    122a <main+0xea>
lea    0xde3(%rip),%rdi
call   1040 <printf@plt>
jmp    1236 <main+0xf6>
lea    0xdd7(%rip),%rdi
call   1040 <printf@plt>
jmp    1162 <main+0x22>
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x78,%rsp
lea    0xeb2(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
subl   $0x1,0xc(%rsp)
jb     118f <main+0x4f>
lea    0x10(%rsp),%rbx
lea    0xe98(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
subl   $0x1,0xc(%rsp)
jae    1170 <main+0x30>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"YES\0A\00"
@.str.2 = [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 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %8
8: ; preds = %52, %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 %53
12: ; preds = %8
store i32 0, i32* %6
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%14 = call i32 @gets(i8* %13)
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%16 = call i32 @strlen(i8* %15)
store i32 %16, i32* %4
store i32 0, i32* %3
br label %17
17: ; preds = %44, %12
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %47
21: ; preds = %17
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 68
br i1 %27, label %42, label %28
28: ; preds = %21
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 74
br i1 %34, label %42, label %35
35: ; preds = %28
%36 = load i32, i32* %3
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 79
br i1 %41, label %42, label %43
42: ; preds = %35, %28, %21
store i32 1, i32* %6
br label %47
43: ; preds = %35
br label %44
44: ; preds = %43
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
store i32 %46, i32* %3
br label %17
47: ; preds = %42, %17
store i32 1, i32* %6
br i1 true, label %48, label %50
48: ; preds = %47
%49 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %52
50: ; preds = %47
%51 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %52
52: ; preds = %50, %48
br label %8
53: ; preds = %8
%54 = load i32, i32* %1
ret i32 %54
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [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 @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 %17, 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, %10
%11 = call i32 @gets(i8* %9)
%12 = call i32 @strlen(i8* %9)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%14 = load i32, i32* %1
%15 = add nsw i32 %14, -1
store i32 %15, i32* %1
%16 = icmp eq i32 %14, 0
br i1 %16, label %17, label %10
17: ; preds = %10, %0
ret i32 0
}