#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (!b)
    return a;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, x, y;
  cin >> n >> x >> y;
  long long z = lcm(x, y);
  map<long long, vector<int> > mp;
  map<int, int> ret;
  long long xx = z / x, yy = z / y;
  for (long long t = xx; t <= z; t += xx) mp[t].push_back(1);
  for (long long t = yy; t <= z; t += yy) mp[t].push_back(2);
  int idx = 0;
  for (map<long long, vector<int> >::iterator it = mp.begin(); it != mp.end();
       it++) {
    vector<int> cur = (*it).second;
    int sz = cur.size();
    for (int i = 0; i < sz; i++) {
      if (sz == 1)
        ret[idx++] = cur[i];
      else
        ret[idx++] = 3;
    }
  }
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    x--;
    int val = ret[x % idx];
    if (val == 1)
      cout << "Vanya" << endl;
    else if (val == 2)
      cout << "Vova" << endl;
    else
      cout << "Both" << endl;
  }
  return 0;
}
