#include <bits/stdc++.h>
using namespace std;
long long sums[5000010];
long long hits[5000010];
int N;
int X, Y;
int arr[5000010];
int who[5000010];
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
map<pair<int, int>, int> mp;
bool way(pair<pair<int, int>, int> aa, pair<pair<int, int>, int> bb) {
  pair<int, int> a = aa.first;
  pair<int, int> b = bb.first;
  return (a.first * 1LL * b.second < a.second * 1LL * b.first);
}
vector<pair<pair<int, int>, int> > vpp;
inline void ReadInput(void) {
  scanf("%d", &N);
  scanf("%d", &X);
  scanf("%d", &Y);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &hits[i]);
  }
}
inline void solve(void) {
  for (int i = 1; i <= X; i++) {
    int temp = gcd(i, X);
    vpp.push_back(
        pair<pair<int, int>, int>(pair<int, int>(i / temp, X / temp), 1));
  }
  for (int i = 1; i <= Y; i++) {
    int temp = gcd(i, Y);
    vpp.push_back(
        pair<pair<int, int>, int>(pair<int, int>(i / temp, Y / temp), 2));
  }
  int curr = 1;
  sort(vpp.begin(), vpp.end(), way);
  for (int i = 0; i < vpp.size(); i++) {
    if (!i or vpp[i].first != vpp[i - 1].first) mp[vpp[i].first] = curr++;
    int kk = mp[vpp[i].first];
    arr[kk]++;
    if (vpp[i].second == 1)
      who[kk] = -1;
    else if (vpp[i].second == 2)
      who[kk] = 1;
    if (arr[kk] == 2) who[kk] = 0;
  }
  curr--;
  for (int i = 1; i <= curr; i++) arr[i] += arr[i - 1];
  for (int i = 1; i <= N; i++) {
    int diff = hits[i];
    diff %= (X + Y);
    int pos = lower_bound(arr, arr + curr + 1, diff) - arr;
    if (who[pos] == 0) {
      printf("Both\n");
    } else if (who[pos] == 1) {
      printf("Vova\n");
    } else if (who[pos] == -1) {
      printf("Vanya\n");
    }
  }
}
inline void Refresh(void) {}
int main() {
  ReadInput();
  solve();
  return 0;
}
