#include <bits/stdc++.h>
using namespace std;
vector<int long long> v;
int arr[100005];
int hcf(int x, int y) {
  int temp;
  if (y > x) {
    temp = x;
    x = y;
    y = temp;
  }
  if (y == 0)
    return x;
  else
    return hcf(y, x % y);
}
int main() {
  int n, x, temp, y, vsize, h;
  int long long lcm;
  cin >> n >> x >> y;
  for (int i = 0; i < n; i++) {
    scanf("%d", &temp);
    arr[i] = temp - 1;
  }
  h = hcf(x, y);
  lcm = (int long long)((int long long)x * y) / h;
  v.push_back(lcm);
  v.push_back(lcm);
  int i = 1;
  while (((int long long)x * i) < lcm) {
    v.push_back((int long long)x * i);
    i++;
  }
  i = 1;
  while ((int long long)y * i < lcm) {
    v.push_back((int long long)y * i);
    i++;
  }
  sort(v.begin(), v.end());
  vsize = v.size();
  for (int i = 0; i < n; i++) {
    arr[i] = arr[i] % (v.size());
    if (v[arr[i]] % x == 0 && v[arr[i]] % y == 0)
      printf("Both\n");
    else if (v[arr[i]] % x == 0)
      printf("Vova\n");
    else
      printf("Vanya\n");
  }
  return 0;
}
