#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<int, int> a, pair<int, int> b) {
  long long p = a.first, q = a.second, r = b.first, s = b.second;
  return p * s < r * q;
}
int main() {
  long long n, x, y;
  cin >> n >> x >> y;
  vector<pair<int, int> > arr;
  for (int i = 1; i <= x; i++) arr.push_back({i, x});
  for (int i = 1; i <= y; i++) arr.push_back({i, y});
  sort(arr.begin(), arr.end(), cmp);
  while (n--) {
    int a;
    cin >> a;
    if (a >= x + y) a = a % (x + y);
    if (a == 0) {
      cout << "Both" << endl;
    } else {
      pair<int, int> hit = arr[a - 1];
      long long p = hit.first, q = hit.second;
      bool vanya = 0, vova = 0;
      if ((p * x) % q == 0) vanya = 1;
      if ((p * y) % q == 0) vova = 1;
      if (vanya and vova)
        cout << "Both" << endl;
      else if (vanya)
        cout << "Vanya" << endl;
      else if (vova)
        cout << "Vova" << endl;
    }
  }
}
