#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10, maxe = 2e6 + 10;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
bool cmp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {
  return 1ll * a.first.first * b.first.second <
         1ll * b.first.first * a.first.second;
}
int n, x, y, gc, t;
pair<pair<int, int>, int> A[maxe];
int main() {
  cin >> n >> x >> y;
  gc = gcd(x, y);
  for (int i = 1; i < x + 1; i++) {
    int g = gcd(i, x);
    if (gc % (x / g) == 0) {
      A[t++] = make_pair(make_pair(i / g, x / g), 2);
      A[t++] = make_pair(make_pair(i / g, x / g), 2);
    } else {
      A[t++] = make_pair(make_pair(i / g, x / g), 0);
    }
  }
  for (int i = 1; i < y + 1; i++) {
    int g = gcd(i, y);
    if (gc % (y / g) != 0) {
      A[t++] = make_pair(make_pair(i / g, y / g), 1);
    }
  }
  sort(A, A + t, cmp);
  for (int i = 0; i < n; i++) {
    int p;
    cin >> p;
    p--;
    p %= t;
    if (A[p].second == 2) {
      cout << "Both\n";
    } else if (A[p].second == 1) {
      cout << "Vova\n";
    } else if (A[p].second == 0) {
      cout << "Vanya\n";
    }
  }
}
