#include<bits/stdc++.h>
using namespace std;
int main()
{
long long int x,y,var;
long long int n,i;
cin>>n>>x>>y;
int v[x+y];
double a=1,b=1;
for(i=0; i<x+y; i++)
{
if(a*y<b*x)
{
v[i]=1;
a+=1;
}
else if(a*y>b*x)
{
v[i]=2;
b+=1;
}
else
{
v[i++]=0;
v[i]=0;
a+=1;
b+=1;
}
}
for(i=0; i<n; i++)
{
cin>>var;
var=var%(x+y);
if(var==0)
{
if(v[x+y-1]==0)cout<<"Both"<<endl;
else if(v[x+y-1]==1)cout<<"Vanya"<<endl;
else if(v[x+y-1]==2)cout<<"Vova"<<endl;
}
else
{
if(v[var-1]==0)cout<<"Both"<<endl;
else if(v[var-1]==1)cout<<"Vanya"<<endl;
else if(v[var-1]==2)cout<<"Vova"<<endl;
}
}
return 0;
}
using namespace std;
int main()
{
long long int x,y,var;
long long int n,i;
cin>>n>>x>>y;
int v[x+y];
double a=1,b=1;
for(i=0; i<x+y; i++)
{
if(a*y<b*x)
{
v[i]=1;
a+=1;
}
else if(a*y>b*x)
{
v[i]=2;
b+=1;
}
else
{
v[i++]=0;
v[i]=0;
a+=1;
b+=1;
}
}
for(i=0; i<n; i++)
{
cin>>var;
var=var%(x+y);
if(var==0)
{
if(v[x+y-1]==0)cout<<"Both"<<endl;
else if(v[x+y-1]==1)cout<<"Vanya"<<endl;
else if(v[x+y-1]==2)cout<<"Vova"<<endl;
}
else
{
if(v[var-1]==0)cout<<"Both"<<endl;
else if(v[var-1]==1)cout<<"Vanya"<<endl;
else if(v[var-1]==2)cout<<"Vova"<<endl;
}
}
return 0;
}