Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.

Chef and Divyam are playing a game with the following rules:
First, an integer $X!$ is written on a board.
Chef and Divyam alternate turns; Chef plays first.
In each move, the current player should choose a positive integer $D$ which is divisible by up to $Y$ distinct primes and does not exceed the integer currently written on the board. Note that $1$ is not a prime.
$D$ is then subtracted from the integer on the board, i.e. if the integer written on the board before this move was $A$, it is erased and replaced by $A-D$.
When one player writes $0$ on the board, the game ends and this player wins.

Given $X$ and $Y$, determine the winner of the game.

------  Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first and only line of each test case contains two space-separated integers $X$ and $Y$.

------  Output ------
For each test case, print a single line containing the string "Chef" if Chef wins the game or "Divyam" if Divyam wins (without quotes).

------  Constraints ------
$1 ≤ T ≤ 10^{6}$
$1 ≤ X,Y ≤ 10^{6}$

------  Subtasks ------
Subtask #1 (5 points): $Y=1$

Subtask #2 (10 points):
$1 ≤ T ≤ 10^{2}$
$1 ≤ X ≤ 6$

Subtask #3 (85 points): original constraints

----- Sample Input 1 ------ 
3

1 2

3 1

2021 42
----- Sample Output 1 ------ 
Chef

Divyam 

Divyam
----- explanation 1 ------ 
Example case 1: Since $D = 1$ is divisible by $0$ primes, Chef will write $0$ and win the game in the first move.

Example case 2: Chef must choose $D$ between $1$ and $5$ inclusive, since $D = 6$ is divisible by more than one prime. Then, Divyam can always choose $6-D$, write $0$ on the board and win the game.

Difficulty: MEDIUM_HARD
Tags: Number theory

Mathematics

Starter code:

Solutions:
import sys

def solve(x, y):
	if primes[x] > y:
		return 'Divyam'
	return 'Chef'

def prime(n):
	primes = ['a' for i in range(n + 1)]
	primes[0] = 0
	primes[1] = 0
	for i in range(2, n + 1):
		if primes[i] == 'a':
			primes[i] = 1 + primes[i - 1]
			j = 2
			while j * i < n:
				primes[j * i] = 0
				j += 1
		elif primes[i] < primes[i - 1]:
			primes[i] = primes[i - 1]
	return primes
primes = prime(1000001)
for _ in range(int(sys.stdin.readline())):
	print(solve(*map(int, sys.stdin.readline().split())))


import sys
l = [1 for i in range(1000002)]
l2 = [0 for i in range(1000001)]
t = 2
while t * t <= 1000001:
	if l[t] == 1:
		for i in range(t * 2, 1000002, t):
			l[i] = 0
	t += 1
l[0] = 0
l[1] = 0
for i in range(1, 1000001):
	if l[i]:
		l2[i] = l2[i - 1] + 1
	else:
		l2[i] = l2[i - 1]
for _ in range(int(sys.stdin.readline())):
	(x, y) = map(int, sys.stdin.readline().split())
	if l2[x] <= y:
		print('Chef')
	else:
		print('Divyam')


import math
from sys import stdin
input = stdin.readline
primes = []

def Sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p]:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			primes.append(p)
Sieve(1100000)
t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	if y > 79000:
		print('Divyam')
		continue
	if x < primes[y]:
		print('Chef')
	else:
		print('Divyam')


import math as m

def findPrimes(n):
	prime = [1] * (n + 1)
	for i in range(2, int(m.sqrt(n)) + 1):
		if prime[i] == 1:
			for j in range(2 * i, n + 1, i):
				prime[j] = 0
	prime[0] = prime[1] = 0
	return prime

def getPrefixSum(n):
	prime = findPrimes(n)
	count = 0
	prefix = list()
	for status in prime:
		if status == 1:
			count += 1
		prefix.append(count)
	return prefix
from sys import stdin, stdout
input = stdin.readline
t = int(input().strip())
prefix = getPrefixSum(1000001)
for _ in range(t):
	(x, y) = list(map(int, input().strip().split()))
	if prefix[x] < y + 1:
		stdout.write('Chef\n')
	else:
		stdout.write('Divyam\n')


import sys
a = 2
arr = [0 for k in range(1000002)]
arr2 = [0 for k in range(1000001)]
while a * a <= 1000001:
	if arr[a] == 0:
		for j in range(a * 2, 1000002, a):
			arr[j] = 1
	a += 1
arr[0] = 1
arr[1] = 1
for k in range(1, 1000001):
	if arr[k]:
		arr2[k] = arr2[k - 1]
	else:
		arr2[k] = arr2[k - 1] + 1
for _ in range(int(sys.stdin.readline())):
	(X, Y) = map(int, sys.stdin.readline().split())
	if arr2[X] <= Y:
		print('Chef')
	else:
		print('Divyam')


import math
import sys

def is_prime(n):
	if n <= 1:
		return False
	max_div = int(math.sqrt(n))
	for i in range(2, 1 + max_div):
		if n % i == 0:
			return False
	return True
a = []
a.append(0)
a.append(0)
c = 0
for i in range(2, 1000001):
	if is_prime(i):
		c = c + 1
	a.append(c)
for _ in range(int(sys.stdin.readline())):
	(x, y) = map(int, sys.stdin.readline().split())
	if a[x] > y:
		print('Divyam')
	else:
		print('Chef')


import sys
input = sys.stdin.readline
prime = [1] * 1000001
pre = [0] * 1000001
i = 2
while i * i < 1000001:
	if prime[i] == 1:
		for j in range(2 * i, 1000001, i):
			prime[j] = 0
	i += 1
pre[0] = 0
pre[1] = 0
for i in range(2, 1000001):
	pre[i] = pre[i - 1] + prime[i]
for i in range(int(input())):
	(x, y) = map(int, input().split())
	if pre[x] <= y:
		print('Chef')
	else:
		print('Divyam')


import math
import sys
x = 1000000
arr = [k for k in range(x + 1)]
prime = [0 for k in range(x + 1)]
prime_count = 0
for i in range(2, int(math.sqrt(x)) + 1):
	if arr[i] == i:
		for j in range(2 * i, x + 1, i):
			arr[j] = i
for i in range(2, x + 1):
	if arr[i] == i:
		prime_count += 1
	prime[i] = prime_count
for _ in range(int(input())):
	(x, y) = tuple(map(int, sys.stdin.readline().split()))
	if prime[x] <= y:
		print('Chef')
	else:
		print('Divyam')


p = [1 for i in range(int(1000001))]
p[0] = 0
p[1] = 0
i = 2
while i * i < len(p):
	if p[i] == 1:
		j = 2
		while i * j < len(p):
			p[i * j] = 0
			j += 1
	i += 1
p_cum = [0 for i in range(int(1000001))]
for i in range(1, len(p)):
	p_cum[i] = p_cum[i - 1] + p[i]
from sys import stdin, stdout
for _ in range(int(input())):
	(x, y) = map(int, stdin.readline().strip().split())
	if p_cum[x] < y + 1:
		print('Chef')
	else:
		print('Divyam')


import sys
input_ = lambda : sys.stdin.readline().strip('\r\n')
iip = lambda : int(input_())
ilp = lambda : list(map(int, input_().split()))
pri = lambda x: print(x)
l = [1] * (10 ** 6 + 5)

def prime():
	n = 10 ** 6
	(l[0], l[1]) = (0, 0)
	for j in range(4, n, 2):
		l[j] = 0
	for i in range(3, int(n ** 0.5) + 1, 2):
		if l[i] == 1:
			for j in range(i * i, n + 1, i):
				l[j] = 0
	for i in range(1, len(l)):
		l[i] += l[i - 1]
prime()
for _ in range(iip()):
	(x, y) = ilp()
	if y == 1:
		if x < 3:
			print('Chef')
		else:
			print('Divyam')
	elif l[x] > y:
		print('Divyam')
	else:
		print('Chef')


import sys
from collections import deque
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : map(int, input_().split())
ilf = lambda : list(map(float, input_().split()))
ip = lambda : input_()
fi = lambda : float(input_())
li = lambda : list(input_())
pr = lambda x: print(x)
prime = [1] * (10 ** 6 + 5)

def generate():
	i = 2
	while i <= 10 ** 3:
		if prime[i] == 1:
			for j in range(i * i, 10 ** 6 + 1, i):
				prime[j] = 0
		i += 1
	for i in range(1, 10 ** 6 + 1):
		prime[i] += prime[i - 1]
generate()
for _ in range(int(input())):
	(x, y) = il()
	if y == 1:
		if x < 3:
			print('Chef')
		else:
			print('Divyam')
		continue
	if prime[x] - 2 <= y:
		print('Chef')
	else:
		print('Divyam')


import sys

def checkPrime():
	primes = [1] * 1000001
	for j in range(2, 1000001):
		for i in range(2 * j, 1000001, j):
			primes[i] = 0
	prime_num = [0] * 1000001
	for j in range(2, 1000001):
		prime_num[j] = prime_num[j - 1] + primes[j]
	return prime_num
prime_nu = checkPrime()
for t in range(int(input())):
	(x, y) = map(int, sys.stdin.readline().split())
	if y >= prime_nu[x]:
		print('Chef')
	else:
		print('Divyam')


lst = [0, 0]

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	count = 0
	for p in range(2, n + 1):
		if prime[p]:
			count += 1
			lst.append(count)
		else:
			lst.append(count)
SieveOfEratosthenes(1000001)
t = int(input())
from sys import stdin, stdout
for _ in range(t):
	(x, y) = map(int, stdin.readline().split())
	if lst[x] > y:
		stdout.write('Divyam\n')
	else:
		stdout.write('Chef\n')


def generatePrimes(mx):
	mark = [True] * (mx + 1)
	for i in range(4, mx + 1, 2):
		mark[i] = False
	p = 3
	while p * p <= mx:
		if mark[p]:
			for i in range(p * p, mx + 1, p):
				mark[i] = False
		p += 2
	(mark[0], mark[1]) = (False, False)
	return mark

def countPrimes(mx):
	primes = generatePrimes(mx)
	prime_count = [0] * (mx + 1)
	c = 0
	for i in range(mx + 1):
		if primes[i]:
			c += 1
		prime_count[i] = c
	return prime_count
mx = 1000000
prime_count = countPrimes(mx)
import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if prime_count[x] <= y:
		print('Chef')
	else:
		print('Divyam')


import sys
n = 10 ** 6
l = [1 for i in range(n + 2)]
l2 = [0 for i in range(n + 1)]
t = 2
while t * t <= n + 1:
	if l[t] == 1:
		for i in range(t * 2, n + 2, t):
			l[i] = 0
	t += 1
l[0] = 0
l[1] = 0
for i in range(1, n + 1):
	if l[i]:
		l2[i] = l2[i - 1] + 1
	else:
		l2[i] = l2[i - 1]
for _ in range(int(sys.stdin.readline())):
	(x, y) = map(int, sys.stdin.readline().split())
	if l2[x] <= y:
		print('Chef')
	else:
		print('Divyam')


from sys import stdin

def sieve():
	n = 1000000
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	dp = [None] * (n + 1)
	dp[0] = dp[1] = 0
	for i in range(2, n + 1):
		dp[i] = dp[i - 1] + int(prime[i])
	return dp
a = sieve()
input = stdin.readline
for i in range(int(input())):
	(x, y) = map(int, input().split())
	if a[x] <= y:
		print('Chef')
	else:
		print('Divyam')


import math as mt
import sys
l = [1 for i in range(1000002)]
l2 = [0 for i in range(1000001)]

def SieveOfEratosthenes():
	t = 2
	while t * t <= 1000001:
		if l[t] == 1:
			for i in range(t * 2, 1000002, t):
				l[i] = 0
		t += 1
	l[0] = 0
	l[1] = 0
	for i in range(1, 1000001):
		if l[i]:
			l2[i] = l2[i - 1] + 1
		else:
			l2[i] = l2[i - 1]

def solve2():
	(x, y) = map(int, fastRead().split())
	factors = l2[x]
	if factors > y:
		return 'Divyam'
	return 'Chef'

def fastRead():
	return sys.stdin.readline()

def fastWrite(op):
	op = str(op) + '\n'
	sys.stdout.write(op)

def main():
	t = int(input())
	SieveOfEratosthenes()
	for _ in range(t):
		fastWrite(solve2())
main()


import sys
n = 1000000
answer = [0] * (n + 1)

def primefactors(n):
	answer[1] = 0
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			answer[p] = answer[p - 1] + 1
		else:
			answer[p] = answer[p - 1]
primefactors(n)
t = int(sys.stdin.readline())
for k in range(t):
	(x, y) = map(int, sys.stdin.readline().split())
	if y == 1:
		if x < 3:
			print('Chef')
		else:
			print('Divyam')
	elif answer[x] > y:
		print('Divyam')
	else:
		print('Chef')


def primes():
	n = 1000000 + 1
	s = [True for i in range(n + 1)]
	v = [0] * n
	for i in range(2, int(n ** 0.5) + 1):
		if s[i]:
			j = 2
			while i * j <= n:
				s[i * j] = False
				j = j + 1
	v[2] = 1
	for i in range(3, n):
		if s[i]:
			v[i] = v[i - 1] + 1
		else:
			v[i] = v[i - 1]
	return v
v = primes()
t = int(input())
a = []
for i in range(t):
	(x, y) = map(int, input().split())
	if y == 1:
		if x > 2:
			a.append('Divyam')
		else:
			a.append('Chef')
	elif x == 1 or x == 2:
		a.append('Chef')
	elif x == 3 and y < 2 or (x == 4 and y < 2) or (x == 5 and y < 3) or (x == 6 and y < 3):
		a.append('Divyam')
	elif v[x] > y:
		a.append('Divyam')
	else:
		a.append('Chef')
print(*a, sep='\n')


import math, sys
input = sys.stdin.readline
INT_MAX = 10 ** 6
sieve = [1] * (INT_MAX + 1)
primes = [0] * (INT_MAX + 1)
cnt = 0
i = 2
sieve[0] = 0
sieve[1] = 0
while i * i <= INT_MAX + 1:
	if sieve[i]:
		j = i * 2
		while j <= INT_MAX:
			sieve[j] = 0
			j += i
	i += 1
for i in range(1, INT_MAX + 1):
	primes[i] = primes[i - 1]
	if sieve[i]:
		primes[i] += 1
for t in range(int(input())):
	(x, y) = map(int, input().split())
	if primes[x] <= y:
		print('Chef')
	else:
		print('Divyam')


from sys import stdin, stdout
n = 1000005
prime = [1 for i in range(n + 1)]
p = 2
while p * p <= n:
	if prime[p]:
		for i in range(p * p, n + 1, p):
			prime[i] = 0
	p += 1
prm = [0, 0]
for i in range(2, n):
	prm.append(prime[i])
for i in range(1, n):
	prm[i] = prm[i] + prm[i - 1]
t = int(stdin.readline())
for T in range(t):
	(x, y) = [int(x) for x in stdin.readline().split()]
	if y < prm[x]:
		print('Divyam')
	else:
		print('Chef')


import sys
MAX_SIZE = 1000003
isprime = [True] * MAX_SIZE
prime = []
SPF = [None] * MAX_SIZE
prime_count = [0] * MAX_SIZE
N = MAX_SIZE
isprime[0] = isprime[1] = False
for i in range(2, N):
	if isprime[i] == True:
		prime_count[i] = prime_count[i - 1] + 1
		prime.append(i)
		SPF[i] = i
	else:
		prime_count[i] = prime_count[i - 1]
	j = 0
	while j < len(prime) and i * prime[j] < N and (prime[j] <= SPF[i]):
		isprime[i * prime[j]] = False
		SPF[i * prime[j]] = prime[j]
		j += 1
for _ in range(int(sys.stdin.readline())):
	(x, y) = map(int, sys.stdin.readline().split())
	if prime_count[x] <= y:
		print('Chef')
	else:
		print('Divyam')


import sys
import math
n = 1000000
isPrime = [1] * (n + 1)
i = 2
while i * i <= n:
	if isPrime[i] == 1:
		for c in range(i * i, n + 1, i):
			isPrime[c] = 0
	i = i + 1
primeCount = [0] * (n + 1)
for i in range(2, n + 1):
	primeCount[i] = primeCount[i - 1] + isPrime[i]
T = int(input())
for _ in range(T):
	(x, y) = map(int, sys.stdin.readline().split())
	if y == 1:
		if x < 3:
			print('Chef')
		else:
			print('Divyam')
	elif primeCount[x] <= y:
		print('Chef')
	else:
		print('Divyam')


import sys
m = 1000000
pr = [True for j in range(1000000 + 1)]
p = 2
while p * p <= m:
	if pr[p] == True:
		for j in range(p * 2, m + 1, p):
			pr[j] = False
	p = p + 1
pr[0] = False
pr[1] = False
a = [0] * 1000000
x = 0
for i in range(1000000):
	if pr[i + 1]:
		x = x + 1
	a[i] = x
t = int(sys.stdin.readline())
for i in range(t):
	l = list(map(int, sys.stdin.readline().split()))
	m = l[0]
	n = l[1]
	if a[m - 1] <= n:
		print('Chef')
	else:
		print('Divyam')


import sys
max = 1000001
prime = [1] * (max + 1)
prefix = [0] * max
p = 2
while p * p <= max:
	if prime[p] == 1:
		for i in range(2 * p, max + 1, p):
			prime[i] = 0
	p += 1
prime[0] = 0
prime[1] = 0
for i in range(1, max):
	if prime[i]:
		prefix[i] = prefix[i - 1] + 1
	else:
		prefix[i] = prefix[i - 1]
for _ in range(int(sys.stdin.readline())):
	(x, y) = map(int, sys.stdin.readline().split())
	if prefix[x] <= y:
		print('Chef')
	else:
		print('Divyam')


import math
import sys

def isPrime(n):
	r = int(math.sqrt(n))
	for i in range(2, r + 1):
		if n % i == 0:
			return False
	return True
d = []
d.append(0)
d.append(0)
c = 0
for i in range(2, 1000001):
	if isPrime(i):
		c = c + 1
	d.append(c)
t = int(sys.stdin.readline())
for ts in range(t):
	(x, y) = map(int, sys.stdin.readline().split())
	if y >= d[x]:
		print('Chef')
	else:
		print('Divyam')


import sys

def SieveOfEratosthenes(n, values={}):
	prime = [True for k in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p]:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	c = 0
	for p in range(2, n):
		if prime[p]:
			c += 1
		values[p] = c
	return values
try:
	data = SieveOfEratosthenes(1000005)
	for _ in range(int(sys.stdin.readline())):
		(X, Y) = map(int, sys.stdin.readline().split(sep=' '))
		if X == 1 or X == 0:
			count = 0
		else:
			count = data[X]
		if Y < count:
			print('Divyam')
		else:
			print('Chef')
except TypeError and EOFError:
	pass


from sys import stdin, stdout
input = stdin.readline
from collections import Counter
from math import sqrt, ceil

def ps(n):
	while n % 2 == 0:
		return True
	for ps in range(3, ceil(sqrt(n)) + 1, 2):
		while n % ps == 0:
			return True
	if n != 1:
		return False
from random import sample
t = int(input())
ql = 10 ** 6 + 1
arr = [0] * (10 ** 6 + 1)
arr[1] = 0
arr[2] = 1
arr[3] = 2
for ipl in range(4, ql):
	if not ps(ipl):
		arr[ipl] = arr[ipl - 1] + 1
	else:
		arr[ipl] = arr[ipl - 1]

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def factorials(n, r):
	slr = n
	dpr = r
	qrr = 1
	qs = 1
	mod = 10 ** 9 + 7
	for ip in range(slr - dpr + 1, slr + 1):
		qlr = qlr * ip % mod
	for ij in range(1, dpr + 1):
		qs = qs * ip % mod
	ans = qlr * modInverse(qs) % mod
	return ans

def modInverse(b):
	qr = 10 ** 9 + 7
	return pow(b, qr - 2, qr)
for jj in range(t):
	(x, y) = list(map(int, input().strip().split()))
	if arr[x] > y:
		print('Divyam')
	else:
		print('Chef')


def MakePrefix():
	prime = [1] * (maximum + 1)
	p = 2
	while p * p <= maximum:
		if prime[p] == 1:
			i = p * 2
			while i <= maximum:
				prime[i] = 0
				i += p
		p += 1
	for p in range(2, maximum + 1):
		prefix[p] = prefix[p - 1]
		if prime[p] == 1:
			prefix[p] += 1

def PrimeCheck(n):
	if n <= 1:
		return False
	if n == 2:
		return True
	if n > 2 and n % 2 == 0:
		return False
	for i in range(3, int(pow(n, 0.5)) + 1, 2):
		if n % i == 0:
			return False
	return True
test = int(input())
x = []
y = []
for i in range(test):
	(a, b) = map(int, input().split())
	x.append(a)
	y.append(b)
maximum = max(x)
prefix = [0] * (maximum + 1)
MakePrefix()
for i in range(test):
	if x[i] == 1:
		print('Chef')
	else:
		count = prefix[x[i]] - prefix[0]
		if count > y[i]:
			print('Divyam')
		else:
			print('Chef')


import sys
t = sys.stdin.readline()
t = int(t)
d = {}
d[0] = 0
d[1] = 0
d[2] = 1
d[3] = 2
d[4] = 2
d[5] = 3
for i in range(6, 10 ** 6 + 1):
	flag = 0
	if i % 2 == 0 or i % 3 == 0:
		d[i] = d[i - 1]
		continue
	for j in range(5, int(i ** 0.5) + 1, 2):
		if i % j == 0:
			flag = 1
			break
	if flag == 0:
		d[i] = d[i - 1] + 1
	else:
		d[i] = d[i - 1]
for e in range(t):
	l = sys.stdin.readline().split()
	x = int(l[0])
	y = int(l[1])
	if x == 1:
		print('Chef')
	elif d[x] <= y:
		print('Chef')
	else:
		print('Divyam')


def prime_values(n, pri):
	prime = [True for i in range(n + 1)]
	pi = 2
	while pi * pi <= n:
		if prime[pi]:
			for i in range(pi * pi, n + 1, pi):
				prime[i] = False
		pi += 1
	for i in range(2, n + 1):
		if prime[i]:
			pri[i] = pri[i - 1] + 1
		else:
			pri[i] = pri[i - 1]
(ar1, ar2) = ([], [])
h = -99999
test = int(input())
for i in range(test):
	(x, y) = map(int, input().split())
	ar1.append(x)
	ar2.append(y)
	h = max(h, x)
p = [0] * (h + 4)
prime_values(h + 1, p)
for i in range(test):
	if p[ar1[i]] > ar2[i]:
		print('Divyam')
	else:
		print('Chef')


import numpy
import sys
input = sys.stdin.readline
pr = []
d = [0 for _ in range(1000005)]

def SieveOfEratosthenes():
	n = 1000005
	pr = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if pr[p] == True:
			for i in range(p * 2, n + 1, p):
				pr[i] = False
		p += 1
	pr[0] = False
	pr[1] = False
	d[0] = 0
	d[1] = 0
	for p in range(n):
		if pr[p]:
			d[p] = d[p - 1] + 1
		else:
			d[p] = d[p - 1]
l = []
SieveOfEratosthenes()
a = int(input())
while a > 0:
	l = [int(l) for l in input().split()]
	if d[int(l[0])] > int(l[1]):
		print('Divyam')
	else:
		print('Chef')
	a = a - 1


import sys
try:

	def Pr(n):
		if n <= 1:
			return False
		if n <= 3:
			return True
		if n % 2 == 0 or n % 3 == 0:
			return False
		i = 5
		while i * i <= n:
			if n % i == 0 or n % (i + 2) == 0:
				return False
			i = i + 6
		return True
	prc = []
	for j in range(0, 1000001):
		if Pr(j):
			prc.append(1)
		else:
			prc.append(0)
	for j in range(3, 1000001):
		prc[j] = prc[j - 1] + prc[j]
	for t in range(int(input())):
		(x, u) = map(int, sys.stdin.readline().strip().split())
		if x == 2 and u == 1:
			sys.stdout.write(str('Chef') + '\n')
		elif prc[x] > u:
			sys.stdout.write(str('Divyam') + '\n')
			continue
		else:
			sys.stdout.write(str('Chef') + '\n')
except EOFError as e:
	pass


import sys
n = 1000001
c = 0
if n >= 2:
	c += 1
l = [1 for i in range(n + 1)]
for i in range(0, n + 1, 2):
	l[i] = 0
l[2] = 1
l[1] = 0
for i in range(3, n + 1, 1):
	if l[i] == 1:
		c += 1
		l[i] = c
		for i in range(i * i, n + 1, i * 2):
			l[i] = 0
	else:
		l[i] = c
t = int(input())
for i in range(t):
	(x, y) = list(map(int, sys.stdin.readline().strip().split()))
	if l[x] > y:
		print('Divyam')
	else:
		print('Chef')


def SieveOfEratosthenes(n):
	prime = [True] * (n + 1)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
t = int(input())
cases = []
n = 0
for i in range(t):
	l = list(map(int, input().split()))
	if n < l[0]:
		n = l[0]
	cases.append(l)
prime = SieveOfEratosthenes(n)
val = [0] * (n + 1)
k = 0
for i in range(2, n + 1):
	if prime[i]:
		k += 1
	val[i] = k
for i in range(t):
	if val[cases[i][0]] <= cases[i][1]:
		print('Chef')
	else:
		print('Divyam')


from math import sqrt as s
from numpy import cumsum as cs
import sys
n = 1000001
c = 0
if n >= 2:
	c += 1
l = [1] * (n + 1)
for i in range(0, n + 1, 2):
	l[i] = 0
l[2] = 1
l[1] = 0
for i in range(3, 1001, 2):
	if l[i] == 1:
		for i in range(i * i, n + 1, i * 2):
			l[i] = 0
ans = cs(l)
t = int(input())
for i in range(t):
	(x, y) = list(map(int, sys.stdin.readline().strip().split()))
	if ans[x] > y:
		print('Divyam')
	else:
		print('Chef')


import sys
input = sys.stdin.readline
MAX = 1000010
t = int(input())
pri = [1 for i in range(MAX)]
i = 2
while i * i <= MAX:
	if pri[i] == 1:
		for j in range(2 * i, MAX, i):
			pri[j] = 0
	i += 1
ans = [0, 0]
for i in range(2, MAX):
	if pri[i]:
		ans.append(ans[i - 1] + 1)
	else:
		ans.append(ans[i - 1])
for _ in range(t):
	a = [int(x) for x in input().split()]
	x = a[0]
	y = a[1]
	if ans[x] > y:
		sys.stdout.write('Divyam\n')
	else:
		sys.stdout.write('Chef\n')