#include <bits/stdc++.h>
using namespace std;
const int MAX_SIZE = (int)3e6;
int n;
int x, y, z, cnt;
int p;
pair<pair<int, int>, bool> q[MAX_SIZE];
int uk;
int gcd(const int &a, const int &b) { return (b ? gcd(b, a % b) : a); }
bool cmp(const pair<pair<int, int>, bool> &a,
         const pair<pair<int, int>, bool> &b) {
  return (a.first.first * 1ll * b.first.second <
          b.first.first * 1ll * a.first.second);
}
bool check(const int &ind) {
  if (ind < uk - 1) {
    if (q[ind].first == q[ind + 1].first) {
      return 1;
    }
  }
  if (ind > 0) {
    if (q[ind].first == q[ind - 1].first) {
      return 1;
    }
  }
  return 0;
}
inline void solve() {
  scanf("%d %d %d", &n, &x, &y);
  for (int i = 1; i <= x; ++i) {
    z = gcd(x, i);
    q[uk] = (make_pair(make_pair(i / z, x / z), 0));
    ++uk;
  }
  for (int i = 1; i <= y; ++i) {
    z = gcd(y, i);
    q[uk] = (make_pair(make_pair(i / z, y / z), 1));
    ++uk;
  }
  int mod = uk;
  sort(q, q + uk, &cmp);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &x);
    cnt = (x % mod - 1 + mod) % mod;
    if (check(cnt)) {
      puts("Both");
    } else {
      if (q[cnt].second) {
        puts("Vova");
      } else {
        puts("Vanya");
      }
    }
  }
}
int main() {
  solve();
  return 0;
}
