#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
struct node {
  long long x, y;
  node(long long x = 0, long long y = 0) : x(x), y(y) {}
  bool operator<(const node& rhs) const { return y < rhs.y; }
};
const int N = 2050000;
int id[N];
node ans[N];
int main() {
  long long n, x, y;
  cin >> n >> x >> y;
  long long g = gcd(x, y);
  long long ll = (x * y) / g;
  long long nx = ll / x, ny = ll / y;
  long long L = lcm(nx, ny);
  int T = L / nx + L / ny;
  int kk = 0;
  for (long long j = nx; j <= L; j += nx) ans[kk++] = (node(1, j));
  for (long long j = ny; j < L; j += ny) ans[kk++] = (node(2, j));
  sort(ans, ans + kk);
  for (int i = 1; i < T; i++) {
    id[i] = ans[i - 1].x;
  }
  for (int i = 1; i <= n; i++) {
    int te;
    scanf("%d", &te);
    te = te % T;
    if (te == 0 || te == T - 1)
      printf("Both\n");
    else {
      id[te] == 1 ? printf("Vanya\n") : printf("Vova\n");
    }
  }
  return 0;
}
