Vanya and his friend Vova play a computer game where they need to destroy n monsters to pass a level. Vanya's character performs attack with frequency x hits per second and Vova's character performs attack with frequency y hits per second. Each character spends fixed time to raise a weapon and then he hits (the time to raise the weapon is 1 / x seconds for the first character and 1 / y seconds for the second one). The i-th monster dies after he receives a_{i} hits. 

Vanya and Vova wonder who makes the last hit on each monster. If Vanya and Vova make the last hit at the same time, we assume that both of them have made the last hit.


-----Input-----

The first line contains three integers n,x,y (1 ≤ n ≤ 10^5, 1 ≤ x, y ≤ 10^6) — the number of monsters, the frequency of Vanya's and Vova's attack, correspondingly.

Next n lines contain integers a_{i} (1 ≤ a_{i} ≤ 10^9) — the number of hits needed do destroy the i-th monster.


-----Output-----

Print n lines. In the i-th line print word "Vanya", if the last hit on the i-th monster was performed by Vanya, "Vova", if Vova performed the last hit, or "Both", if both boys performed it at the same time.


-----Examples-----
Input
4 3 2
1
2
3
4

Output
Vanya
Vova
Vanya
Both

Input
2 1 1
1
2

Output
Both
Both



-----Note-----

In the first sample Vanya makes the first hit at time 1 / 3, Vova makes the second hit at time 1 / 2, Vanya makes the third hit at time 2 / 3, and both boys make the fourth and fifth hit simultaneously at the time 1.

In the second sample Vanya and Vova make the first and second hit simultaneously at time 1.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Mathematics

Sorting

Implementation


Solutions:
(n, x, y) = list(map(int, input().split()))
(cx, cy, A) = (0, 0, [])
while cx < x or cy < y:
	if (cx + 1) * y > (cy + 1) * x:
		cy += 1
		A.append('Vova')
	elif (cx + 1) * y < (cy + 1) * x:
		cx += 1
		A.append('Vanya')
	else:
		A.append('Both')
		A.append('Both')
		cx += 1
		cy += 1
for _ in range(n):
	a = int(input())
	a -= 1
	a1 = a % (x + y)
	print(A[a1])


(n, x, y) = map(int, input().split())

def f(a, x, y):
	return (a * x + x + y - 1) // (x + y)
for _ in [0] * n:
	n = int(input())
	r = f(n, x, y) * y - f(n, y, x) * x
	print(['Both', 'Vova', 'Vanya'][(r > 0) + (r < 0) * 2])


(n, x, y) = list(map(int, input().split()))

def fun(a1, x1, y1):
	return (a1 * x1 + x1 + y1 - 1) // (x + y)
for _ in range(n):
	a = int(input())
	op1 = fun(a, x, y) * y
	op2 = fun(a, y, x) * x
	if op1 == op2:
		print('Both')
	elif op1 < op2:
		print('Vanya')
	elif op1 > op2:
		print('Vova')


input = __import__('sys').stdin.readline
(n, x, y) = map(int, input().split())
ans = []
cx = cy = 1
for i in range(x + y - 1):
	if cx / x > cy / y:
		ans.append(1)
		cy += 1
	elif cx / x < cy / y:
		ans.append(0)
		cx += 1
	else:
		ans.append(2)
		ans.append(2)
		cx += 1
		cy += 1
f = ['Vanya', 'Vova', 'Both']
for _ in range(n):
	n = int(input()) - 1
	print(f[ans[n % (x + y)]])


read = lambda : list(map(int, input().split()))
f = lambda a, x, y: (a * x + x + y - 1) // (x + y)
(n, x, y) = read()
for i in range(n):
	a = int(input())
	d = f(a, x, y) * y - f(a, y, x) * x
	if d < 0:
		res = 'Vanya'
	elif d > 0:
		res = 'Vova'
	elif d == 0:
		res = 'Both'
	print(res)


(n, x, y) = map(int, input().split())
for _ in range(n):
	a = int(input())
	(c1, c2) = ((a + 1) * x // (x + y) / x, (a + 1) * y // (x + y) / y)
	if c1 == c2:
		print('Both')
	elif c1 > c2:
		print('Vanya')
	else:
		print('Vova')


from sys import stdin

def main():
	(n, x, y) = map(int, stdin.readline().strip().split())
	xy = x + y
	for health in map(int, (stdin.readline().strip() for _ in range(n))):
		health %= xy
		hitsx = health * x // xy
		hitsy = health * y // xy
		health -= hitsx + hitsy
		tx = hitsx * y
		ty = hitsy * x
		while health > 0:
			(tx1, ty1) = (tx + y, ty + x)
			if tx1 < ty1:
				tx = tx1
				health -= 1
			elif tx1 > ty1:
				ty = ty1
				health -= 1
			else:
				(tx, ty) = (tx1, ty1)
				health -= 1
		print('Vova' if tx < ty else 'Vanya' if tx > ty else 'Both')
main()


__author__ = 'zhan'
[n, x, y] = [int(i) for i in input().split()]
inpu = [0] * n
for i in range(n):
	inpu[i] = int(input())
ox = x
oy = y
loop = x + y
hits = [2] * (loop + 1)
i = 1
while i <= loop:
	if y < x:
		hits[i] = 0
		y += oy
		i += 1
	elif x < y:
		hits[i] = 1
		x += ox
		i += 1
	else:
		hits[i] = 2
		hits[i + 1] = 2
		x += ox
		y += oy
		i += 2
final = [''] * n
i = 0
for inp in inpu:
	k = inp % loop
	if hits[k] == 0:
		final[i] = 'Vanya'
	elif hits[k] == 1:
		final[i] = 'Vova'
	else:
		final[i] = 'Both'
	i += 1
print('\n'.join(final))


__author__ = 'PrimuS'
(n, a, b) = (int(x) for x in input().split())
mobs = [0] * n
for i in range(n):
	mobs[i] = int(input())
total = a + b
ans = [0] * (total + 1)
aa = 0
bb = 0
ans[0] = 2
i = 1
while i <= total:
	t1 = aa + b
	t2 = bb + a
	if t1 == t2:
		aa += b
		bb += a
		ans[i] = 2
		ans[i + 1] = 2
		i += 2
	elif t1 < t2:
		aa = t1
		ans[i] = 0
		i += 1
	else:
		bb = t2
		ans[i] = 1
		i += 1
res = [''] * len(mobs)
i = 0
for m in mobs:
	k = m % total
	if ans[k] == 0:
		res[i] = 'Vanya'
	elif ans[k] == 1:
		res[i] = 'Vova'
	else:
		res[i] = 'Both'
	i += 1
print('\n'.join(res))


(n, x, y) = map(int, input().split())
result = []
for _ in range(n):
	a = int(input())
	vanya_hits = x * (a + 1) // (x + y)
	vova_hits = y * (a + 1) // (x + y)
	if vanya_hits / x == vova_hits / y:
		result.append('Both')
	elif vanya_hits / x > vova_hits / y:
		result.append('Vanya')
	else:
		result.append('Vova')
print(*result, sep='\n')


(n, x, y) = map(int, input().split(' '))
for i in range(n):
	s = int(input())
	a = x * (s + 1) // (x + y)
	b = y * (s + 1) // (x + y)
	if a * y == b * x:
		print('Both')
	elif int(a) / x < int(b) / y:
		print('Vova')
	else:
		print('Vanya')


from fractions import gcd
(n, x, y) = map(int, input().split())
g = gcd(x, y)
x //= g
y //= g
a = sorted([y * i for i in range(1, x)] + [x * i for i in range(1, y)])

def f(n):
	n %= x + y
	if n == 0 or n == x + y - 1:
		return 'Both'
	return 'Vova' if a[n - 1] % x == 0 else 'Vanya'
for _ in range(n):
	print(f(int(input())))


(n, x, y) = list(map(int, input().split()))
a = list()
for i in range(n):
	a.append(int(input()))
hits = 0
cx = 1
cy = 1
r = list()
while hits < x + y:
	if cx / x < cy / y:
		cx += 1
		hits += 1
		r.append('Vanya')
	elif cx / x > cy / y:
		cy += 1
		hits += 1
		r.append('Vova')
	else:
		cy += 1
		cx += 1
		hits += 2
		r.append('Both')
		r.append('Both')
for m in a:
	print(r[(m - 1) % (x + y)])


(n, x, y) = map(int, input().split())
while n > 0:
	s = int(input())
	a = x * (s + 1) // (x + y)
	b = y * (s + 1) // (x + y)
	if a * y == b * x:
		print('Both')
	elif int(a) / x < int(b) / y:
		print('Vova')
	else:
		print('Vanya')
	n -= 1


from fractions import gcd

def main():
	(n, x, y) = list(map(int, input().split()))
	monsters = [int(input()) for _ in range(n)]
	if x == y:
		results = ['Both'] * n
	else:
		results = []
		g = gcd(x, y)
		x //= g
		y //= g
		turns = [i * x for i in range(1, y)] + [i * y for i in range(1, x)]
		turns.sort()
		freq_sum = x + y
		for monster in monsters:
			monster %= freq_sum
			if monster == 0 or monster == freq_sum - 1:
				results.append('Both')
			else:
				results.append('Vanya' if turns[monster - 1] % y == 0 else 'Vova')
	print('\n'.join(results))
main()


from collections import OrderedDict

def main():
	(n, x, y) = map(int, input().split())
	table = []
	(ix, iy) = (1, 1)
	while ix <= x or iy <= y:
		if ix * x < iy * y:
			table.append(1)
			ix += 1
		elif ix * x > iy * y:
			table.append(2)
			iy += 1
		else:
			table += [0, 0]
			break
	for _ in range(n):
		h = (int(input()) - 1) % len(table)
		print(['Both', 'Vova', 'Vanya'][table[h]])

def __starting_point():
	main()
__starting_point()


(n, x, y) = [int(x) for x in input().split()]
dp = []
(cx, cy) = (0, 0)
while cx < x and cy < y:
	if (cx + 1) / x > (cy + 1) / y:
		dp.append('Vova')
		cy += 1
	elif (cx + 1) / x < (cy + 1) / y:
		dp.append('Vanya')
		cx += 1
	else:
		dp.append('Both')
		dp.append('Both')
		cx += 1
		cy += 1
for i in range(n):
	print(dp[(int(input()) - 1) % (x + y)])


(n, x, y) = list(map(int, input().split()))
for i in range(n):
	hit = int(input())
	vayna_hits_rate = int(x * (hit + 1) / (x + y)) / x
	voya_hits_rate = int(y * (hit + 1) / (x + y)) / y
	if vayna_hits_rate == voya_hits_rate:
		print('Both')
	elif vayna_hits_rate > voya_hits_rate:
		print('Vanya')
	else:
		print('Vova')