#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> c[3000000 + 10];
long long n, x, y, a[3000000 + 10], b[3000000 + 10], k, nzd, nzs, pok1, pok2, p,
    o;
int main() {
  cin >> n >> x >> y;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= x; i++) {
    k++;
    c[k] = make_pair(y * i, 1);
  }
  for (int i = 1; i <= y; i++) {
    k++;
    c[k] = make_pair(x * i, 2);
  }
  sort(c + 1, c + k + 1);
  for (int i = 2; i <= k; i++)
    if (c[i].first == c[i - 1].first) {
      c[i].second = 3;
      c[i - 1].second = 3;
    }
  for (int i = 1; i <= k; i++) {
    b[i] = c[i].second;
  }
  for (int i = 1; i <= n; i++) {
    a[i] %= k;
    if (a[i] == 0) a[i] += k;
    if (b[a[i]] == 1) printf("Vanya\n");
    if (b[a[i]] == 2) printf("Vova\n");
    if (b[a[i]] == 3) printf("Both\n");
  }
  return 0;
}
