#include <bits/stdc++.h>
int x4[4] = {0, 0, -1, 1};
int y4[4] = {-1, 1, 0, 0};
int x8[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
int y8[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
int xhorse[8] = {1, 2, 1, 2, -1, -2, -1, -2};
int yhorse[8] = {2, 1, -2, -1, 2, 1, -2, -1};
using namespace std;
long long gcd(long long a, long long b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}
long long initVanya;
long long initVova;
long long n, xx, yy;
vector<long long> vec;
void pre() {
  long long g = gcd(xx, yy);
  xx /= g;
  yy /= g;
  g = gcd(xx, yy);
  long long kpk = xx * yy / g;
  initVanya = kpk / xx;
  initVova = kpk / yy;
  long long vanya = initVanya;
  long long vova = initVova;
  while (vanya != kpk) {
    vec.push_back(vanya);
    vanya += initVanya;
  }
  while (vova != kpk) {
    vec.push_back(vova);
    vova += initVova;
  }
  vec.push_back(kpk);
  vec.push_back(kpk);
  sort(vec.begin(), vec.end());
}
int main() {
  vec.clear();
  scanf("%I64d %I64d %I64d", &n, &xx, &yy);
  pre();
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    a--;
    a %= vec.size();
    if (vec[a] % initVanya == 0 && vec[a] % initVova == 0)
      printf("Both\n");
    else if (vec[a] % initVanya == 0)
      printf("Vanya\n");
    else
      printf("Vova\n");
  }
  return 0;
}
